Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -230,10 +230,19 @@ $$
|
|
230 |
|
231 |
# Example usage in a Gradio interface
|
232 |
def process_input(video, youtube_link):
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
raise ValueError("Please provide either a video file or a YouTube link, not both.")
|
235 |
|
236 |
-
if
|
237 |
print(video)
|
238 |
|
239 |
# # Load model globally
|
@@ -248,7 +257,9 @@ def process_input(video, youtube_link):
|
|
248 |
return image, df_show, gr.Markdown(note), tsne_image
|
249 |
|
250 |
else:
|
251 |
-
|
|
|
|
|
252 |
"YouTube Link cannot be empty if no video is provided."
|
253 |
|
254 |
video_id = get_video_id_from_url(youtube_link)
|
|
|
230 |
|
231 |
# Example usage in a Gradio interface
|
232 |
def process_input(video, youtube_link):
|
233 |
+
|
234 |
+
provided_video = video is not None
|
235 |
+
if youtube_link is None:
|
236 |
+
provided_link = False
|
237 |
+
elif isinstance(youtube_link, str):
|
238 |
+
provided_link = len(youtube_link) > 0
|
239 |
+
else:
|
240 |
+
raise ValueError(f"Invalid type of link {youtube_link}.")
|
241 |
+
|
242 |
+
if provided_video and provided_link:
|
243 |
raise ValueError("Please provide either a video file or a YouTube link, not both.")
|
244 |
|
245 |
+
if provided_video:
|
246 |
print(video)
|
247 |
|
248 |
# # Load model globally
|
|
|
257 |
return image, df_show, gr.Markdown(note), tsne_image
|
258 |
|
259 |
else:
|
260 |
+
print(provided_link)
|
261 |
+
|
262 |
+
assert provided_link, \
|
263 |
"YouTube Link cannot be empty if no video is provided."
|
264 |
|
265 |
video_id = get_video_id_from_url(youtube_link)
|