Spaces:
Running
on
Zero
Running
on
Zero
Merge branch 'main' of https://huggingface.co/spaces/Tonic/Llava-Video
Browse files
app.py
CHANGED
@@ -90,19 +90,7 @@ def process_video(video_path, question):
|
|
90 |
def gradio_interface(video_file, question):
|
91 |
if video_file is None:
|
92 |
return "Please upload a video file."
|
93 |
-
|
94 |
-
# Create a temporary directory to store the video
|
95 |
-
with tempfile.TemporaryDirectory() as temp_dir:
|
96 |
-
temp_video_path = os.path.join(temp_dir, "temp_video.mp4")
|
97 |
-
|
98 |
-
# Copy the video file to the temporary directory
|
99 |
-
shutil.copy2(video_file, temp_video_path)
|
100 |
-
|
101 |
-
try:
|
102 |
-
response = process_video(temp_video_path, question)
|
103 |
-
except Exception as e:
|
104 |
-
return f"An error occurred: {str(e)}"
|
105 |
-
|
106 |
return response
|
107 |
|
108 |
with gr.Blocks() as demo:
|
|
|
90 |
def gradio_interface(video_file, question):
|
91 |
if video_file is None:
|
92 |
return "Please upload a video file."
|
93 |
+
response = process_video(video_file, question)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
return response
|
95 |
|
96 |
with gr.Blocks() as demo:
|