Spaces:
Running
on
Zero
Running
on
Zero
Update src/app/response.py
Browse files- src/app/response.py +5 -0
src/app/response.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# Necessary imports
|
2 |
import sys
|
3 |
from typing import Any, Dict
|
|
|
4 |
import spaces
|
5 |
|
6 |
# Local imports
|
@@ -39,6 +40,10 @@ def describe_video(video: str, question: str) -> str:
|
|
39 |
str: The generated answer to the question.
|
40 |
"""
|
41 |
try:
|
|
|
|
|
|
|
|
|
42 |
# Encode the video frames
|
43 |
frames = encode_video(video)
|
44 |
|
|
|
1 |
# Necessary imports
|
2 |
import sys
|
3 |
from typing import Any, Dict
|
4 |
+
import gradio as gr
|
5 |
import spaces
|
6 |
|
7 |
# Local imports
|
|
|
40 |
str: The generated answer to the question.
|
41 |
"""
|
42 |
try:
|
43 |
+
# Check if video or question is None
|
44 |
+
if video is None or question is None:
|
45 |
+
raise gr.Error("Video or question cannot be None.")
|
46 |
+
|
47 |
# Encode the video frames
|
48 |
frames = encode_video(video)
|
49 |
|