-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
165 lines (150 loc) · 6.67 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import dash
from dash import dcc
from dash import html
import dash_player as player
import numpy as np
import pandas as pd
import plotly.graph_objs as go
from dash.dependencies import Input, Output, State
import pathlib
FRAMERATE = 24.0
def load_data(path):
# Load the dataframe
video_info_df = pd.read_csv("data.csv",index_col=0)
return video_info_df
video_info_df = load_data("data.csv")
app = dash.Dash(
__name__,
meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}],
)
app.title = "ModzEd"
server = app.server
app.config.suppress_callback_exceptions = True
BASE_PATH = pathlib.Path(__file__).parent.resolve()
DATA_PATH = BASE_PATH.joinpath("data").resolve()
# Main App
app.layout = html.Div(
children=[
dcc.Interval(id="interval-updating-graphs", interval=1000, n_intervals=0),
html.Div(id="top-bar", className="row"),
html.Div(
className="container",
children=[
html.Div(
id="left-side-column",
className="eight columns",
children=[
html.Img(
id="logo-mobile", src=app.get_asset_url("dash-logo.png")
),
html.Div(
id="header-section",
children=[
html.H1("ModzED"),
html.H5("Simplifying Online Education"),
html.Br(),
html.Br(),
html.P(
"To get started, for the sample video select the desired operation from the drop down menu"
),
html.Ul(
children=[
html.Li("Transcript - View transcript of the uploaded video"),
html.Li("Summary - Reduce a long video into a short, manageable summary."),
html.Li("Important Topics - Learn about the important topics covered in the video"),
html.Li("Lookup Keywords - Search for the desired topic in a video along with its timestamp"),
html.Li("Video Captioning - Get what the video is actually about"),
],
),
],
),
html.Div(
className="video-outer-container",
children=html.Div(
className="video-container",
children=player.DashPlayer(
id="video-display",
url="https://www.youtube.com/watch?v=CgFVgp_VCN8",
controls=True,
playing=False,
volume=1,
width="100%",
height="100%",
),
),
),
html.Div(
className="control-section",
children=[
html.Div(
className="control-element",
children=[
html.Div(children=["Select Operation:"]),
dcc.Dropdown(
id="dropdown-select-op",
options=[
{
"label": "Transcript",
"value": "Transcript",
},
{
"label": "Summary",
"value": "Summary",
},
{
"label": "Important Topics",
"value": "Topics",
},
{
"label": "Lookup",
"value": "Lookup",
},
{
"label": "Video Captions",
"value": "Caption",
},
],
value="Select Any Option",
clearable=False,
),
],
),
],
),
],
),
html.Div(
id="right-side-column",
className="four columns",
children=[
html.Div(
className="img-container",
children=html.Img(
id="logo-web", src=app.get_asset_url("dash-logo.png")
),
),
html.Div(id="div-visual-mode"),
],
),
],
),
]
)
@app.callback(
Output("div-visual-mode", "children"),
[Input("dropdown-select-op", "value")]
)
def reset_threshold_center(value):
if value == "Transcript":
return video_info_df.iloc[0].values
if value == "Summary":
return video_info_df.iloc[1].values
if value == "Topics":
return video_info_df.iloc[2].values
if value == "Lookup":
return video_info_df.iloc[3].values
if value == "Caption":
return video_info_df.iloc[4].values
# Running the server
if __name__ == "__main__":
app.run_server()