Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ from decord import VideoReader, cpu
|
|
| 9 |
from scipy.spatial import cKDTree
|
| 10 |
import math
|
| 11 |
import warnings
|
|
|
|
| 12 |
warnings.filterwarnings("ignore")
|
| 13 |
|
| 14 |
# Global variables for model and tokenizer
|
|
@@ -87,6 +88,7 @@ def encode_video(video_path, choose_fps=3, max_frames=180, max_packing=3, time_s
|
|
| 87 |
|
| 88 |
return frames, frame_ts_id_group
|
| 89 |
|
|
|
|
| 90 |
def process_input(
|
| 91 |
file_input,
|
| 92 |
user_prompt,
|
|
@@ -105,7 +107,7 @@ def process_input(
|
|
| 105 |
return "Please upload an image or video file."
|
| 106 |
|
| 107 |
# Determine if input is image or video
|
| 108 |
-
file_path = file_input
|
| 109 |
file_ext = os.path.splitext(file_path)[1].lower()
|
| 110 |
|
| 111 |
is_video = file_ext in ['.mp4', '.avi', '.mov', '.mkv', '.webm', '.m4v']
|
|
@@ -174,8 +176,7 @@ def create_interface():
|
|
| 174 |
# File input
|
| 175 |
file_input = gr.File(
|
| 176 |
label="Upload Image or Video",
|
| 177 |
-
file_types=["image", "video"]
|
| 178 |
-
type="filepath"
|
| 179 |
)
|
| 180 |
|
| 181 |
# Video FPS setting
|
|
@@ -319,10 +320,4 @@ def create_interface():
|
|
| 319 |
if __name__ == "__main__":
|
| 320 |
# Create and launch interface
|
| 321 |
demo = create_interface()
|
| 322 |
-
demo.
|
| 323 |
-
demo.launch(
|
| 324 |
-
share=True,
|
| 325 |
-
server_name="0.0.0.0",
|
| 326 |
-
server_port=7860,
|
| 327 |
-
show_error=True
|
| 328 |
-
)
|
|
|
|
| 9 |
from scipy.spatial import cKDTree
|
| 10 |
import math
|
| 11 |
import warnings
|
| 12 |
+
import spaces
|
| 13 |
warnings.filterwarnings("ignore")
|
| 14 |
|
| 15 |
# Global variables for model and tokenizer
|
|
|
|
| 88 |
|
| 89 |
return frames, frame_ts_id_group
|
| 90 |
|
| 91 |
+
@spaces.GPU
|
| 92 |
def process_input(
|
| 93 |
file_input,
|
| 94 |
user_prompt,
|
|
|
|
| 107 |
return "Please upload an image or video file."
|
| 108 |
|
| 109 |
# Determine if input is image or video
|
| 110 |
+
file_path = file_input
|
| 111 |
file_ext = os.path.splitext(file_path)[1].lower()
|
| 112 |
|
| 113 |
is_video = file_ext in ['.mp4', '.avi', '.mov', '.mkv', '.webm', '.m4v']
|
|
|
|
| 176 |
# File input
|
| 177 |
file_input = gr.File(
|
| 178 |
label="Upload Image or Video",
|
| 179 |
+
file_types=["image", "video"]
|
|
|
|
| 180 |
)
|
| 181 |
|
| 182 |
# Video FPS setting
|
|
|
|
| 320 |
if __name__ == "__main__":
|
| 321 |
# Create and launch interface
|
| 322 |
demo = create_interface()
|
| 323 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|