Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import subprocess
|
|
8 |
import numpy as np
|
9 |
import os
|
10 |
from threading import Thread
|
|
|
11 |
import io
|
12 |
|
13 |
# Model and Processor Loading (Done once at startup)
|
@@ -35,7 +36,7 @@ def identify_and_save_blob(blob):
|
|
35 |
extension = ".mp4"
|
36 |
media_type = "video"
|
37 |
|
38 |
-
filename = f"
|
39 |
with open(filename, "wb") as f:
|
40 |
f.write(blob)
|
41 |
return filename, media_type
|
@@ -52,7 +53,9 @@ def qwen_inference(media_input, text_input=None):
|
|
52 |
else:
|
53 |
try:
|
54 |
media_path, media_type = identify_and_save_blob(media_input)
|
55 |
-
|
|
|
|
|
56 |
raise ValueError(
|
57 |
"Unsupported media type. Please upload an image or video."
|
58 |
)
|
|
|
8 |
import numpy as np
|
9 |
import os
|
10 |
from threading import Thread
|
11 |
+
import uuid
|
12 |
import io
|
13 |
|
14 |
# Model and Processor Loading (Done once at startup)
|
|
|
36 |
extension = ".mp4"
|
37 |
media_type = "video"
|
38 |
|
39 |
+
filename = f"temp_{uuid.uuid4()}_media{extension}"
|
40 |
with open(filename, "wb") as f:
|
41 |
f.write(blob)
|
42 |
return filename, media_type
|
|
|
53 |
else:
|
54 |
try:
|
55 |
media_path, media_type = identify_and_save_blob(media_input)
|
56 |
+
print(media_path, media_type)
|
57 |
+
except Exception as e:
|
58 |
+
print(E)
|
59 |
raise ValueError(
|
60 |
"Unsupported media type. Please upload an image or video."
|
61 |
)
|