Spaces:
Running
on
Zero
Running
on
Zero
add zeroGPU decoration
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from PIL import Image
|
|
4 |
import numpy as np
|
5 |
import os
|
6 |
import tempfile
|
|
|
7 |
import gradio as gr
|
8 |
|
9 |
import cv2
|
@@ -61,6 +62,7 @@ def visualize(pred_mask, image_path, work_dir):
|
|
61 |
cv2.imwrite(output_path, visual_result)
|
62 |
return output_path
|
63 |
|
|
|
64 |
def image_vision(image_input_path, prompt):
|
65 |
image_path = image_input_path
|
66 |
text_prompts = f"<image>{prompt}"
|
@@ -88,6 +90,7 @@ def image_vision(image_input_path, prompt):
|
|
88 |
else:
|
89 |
return answer, None
|
90 |
|
|
|
91 |
def video_vision(video_input_path, prompt, video_interval):
|
92 |
# Open the original video
|
93 |
cap = cv2.VideoCapture(video_input_path)
|
|
|
4 |
import numpy as np
|
5 |
import os
|
6 |
import tempfile
|
7 |
+
import spaces
|
8 |
import gradio as gr
|
9 |
|
10 |
import cv2
|
|
|
62 |
cv2.imwrite(output_path, visual_result)
|
63 |
return output_path
|
64 |
|
65 |
+
@spaces.GPU
|
66 |
def image_vision(image_input_path, prompt):
|
67 |
image_path = image_input_path
|
68 |
text_prompts = f"<image>{prompt}"
|
|
|
90 |
else:
|
91 |
return answer, None
|
92 |
|
93 |
+
@spaces.GPU(duration=80)
|
94 |
def video_vision(video_input_path, prompt, video_interval):
|
95 |
# Open the original video
|
96 |
cap = cv2.VideoCapture(video_input_path)
|