Spaces:
Runtime error
Runtime error
Commit
·
0da2b4b
1
Parent(s):
4b79df0
Update app.py
Browse files
app.py
CHANGED
@@ -112,60 +112,23 @@ def predict(youtube_url_or_file_path):
|
|
112 |
return label_to_score, gif_path
|
113 |
|
114 |
|
115 |
-
app = gr.
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
""
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
value=DEFAULT_MODEL,
|
134 |
-
)
|
135 |
-
model_names_dropdown.change(fn=select_model, inputs=model_names_dropdown)
|
136 |
-
with gr.Tab(label="Youtube URL"):
|
137 |
-
gr.Markdown("### **Provide a Youtube video URL**")
|
138 |
-
youtube_url = gr.Textbox(label="Youtube URL:", show_label=True)
|
139 |
-
youtube_url_predict_btn = gr.Button(value="Predict")
|
140 |
-
with gr.Tab(label="Local File"):
|
141 |
-
gr.Markdown("### **Upload a video file**")
|
142 |
-
video_file = gr.Video(label="Video File:", show_label=True)
|
143 |
-
local_video_predict_btn = gr.Button(value="Predict")
|
144 |
-
with gr.Column():
|
145 |
-
video_gif = gr.Image(
|
146 |
-
label="Input Clip",
|
147 |
-
show_label=True,
|
148 |
-
)
|
149 |
-
with gr.Column():
|
150 |
-
predictions = gr.Label(
|
151 |
-
label="Predictions:", show_label=True, num_top_classes=5
|
152 |
-
)
|
153 |
-
|
154 |
-
gr.Markdown("**Examples:**")
|
155 |
-
gr.Examples(
|
156 |
-
examples,
|
157 |
-
youtube_url,
|
158 |
-
[predictions, video_gif],
|
159 |
-
fn=predict,
|
160 |
-
cache_examples=True,
|
161 |
-
)
|
162 |
-
|
163 |
-
youtube_url_predict_btn.click(
|
164 |
-
predict, inputs=youtube_url, outputs=[predictions, video_gif]
|
165 |
-
)
|
166 |
-
local_video_predict_btn.click(
|
167 |
-
predict, inputs=video_file, outputs=[predictions, video_gif]
|
168 |
-
)
|
169 |
-
|
170 |
|
171 |
app.launch()
|
|
|
112 |
return label_to_score, gif_path
|
113 |
|
114 |
|
115 |
+
app = gr.Interface(
|
116 |
+
fn=predict,
|
117 |
+
inputs=[
|
118 |
+
gr.Interface.Dropdown(
|
119 |
+
choices=VALID_VIDEOCLASSIFICATION_MODELS,
|
120 |
+
label="Model:",
|
121 |
+
show_label=True,
|
122 |
+
value=DEFAULT_MODEL,
|
123 |
+
),
|
124 |
+
gr.Interface.Textbox(label="Youtube URL:", show_label=True),
|
125 |
+
gr.Interface.Video(label="Video File:", show_label=True),
|
126 |
+
],
|
127 |
+
outputs=[
|
128 |
+
gr.Interface.Label(label="Predictions:", show_label=True, num_top_classes=5),
|
129 |
+
gr.Interface.Image(label="Input Clip", show_label=True),
|
130 |
+
],
|
131 |
+
layout="vertical",
|
132 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
app.launch()
|