Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,6 @@ model = LlavaNextVideoForConditionalGeneration.from_pretrained(
|
|
| 20 |
device_map='auto'
|
| 21 |
)
|
| 22 |
|
| 23 |
-
@spaces.GPU
|
| 24 |
def read_video_pyav(container, indices):
|
| 25 |
'''
|
| 26 |
Decode the video with PyAV decoder.
|
|
@@ -73,20 +72,19 @@ def process_video(video_file, question_parts):
|
|
| 73 |
|
| 74 |
return generated_text.split("ASSISTANT: ", 1)[-1].strip()
|
| 75 |
|
| 76 |
-
|
| 77 |
-
def process_videos(video_files, question_parts):
|
| 78 |
"""Processes multiple videos and answers a single question for each."""
|
| 79 |
answers = []
|
| 80 |
for video_file in video_files:
|
| 81 |
video_name = os.path.basename(video_file.name)
|
| 82 |
-
answer = process_video(video_file,
|
| 83 |
answers.append(f"**Video: {video_name}**\n{answer}\n")
|
| 84 |
return "\n---\n".join(answers)
|
| 85 |
|
| 86 |
# Define Gradio interface for multiple videos
|
| 87 |
def gradio_interface(videos, indoors_outdoors, standing_sitting, hands_free, interacting_screen):
|
| 88 |
|
| 89 |
-
question = "Is the subject in the video
|
| 90 |
if indoors_outdoors:
|
| 91 |
question += "present indoors or outdoors? "
|
| 92 |
if standing_sitting:
|
|
|
|
| 20 |
device_map='auto'
|
| 21 |
)
|
| 22 |
|
|
|
|
| 23 |
def read_video_pyav(container, indices):
|
| 24 |
'''
|
| 25 |
Decode the video with PyAV decoder.
|
|
|
|
| 72 |
|
| 73 |
return generated_text.split("ASSISTANT: ", 1)[-1].strip()
|
| 74 |
|
| 75 |
+
def process_videos(video_files, question):
|
|
|
|
| 76 |
"""Processes multiple videos and answers a single question for each."""
|
| 77 |
answers = []
|
| 78 |
for video_file in video_files:
|
| 79 |
video_name = os.path.basename(video_file.name)
|
| 80 |
+
answer = process_video(video_file, question)
|
| 81 |
answers.append(f"**Video: {video_name}**\n{answer}\n")
|
| 82 |
return "\n---\n".join(answers)
|
| 83 |
|
| 84 |
# Define Gradio interface for multiple videos
|
| 85 |
def gradio_interface(videos, indoors_outdoors, standing_sitting, hands_free, interacting_screen):
|
| 86 |
|
| 87 |
+
question = "Is the subject in the video"
|
| 88 |
if indoors_outdoors:
|
| 89 |
question += "present indoors or outdoors? "
|
| 90 |
if standing_sitting:
|