Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -146,7 +146,12 @@ def show_preview_from_upload(files):
|
|
146 |
img = Image.open(file).convert("RGB")
|
147 |
return gr.update(value=img, visible=True), gr.update(visible=False)
|
148 |
elif path.endswith((".mp4", ".mov", ".avi")):
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
150 |
return gr.update(visible=False), gr.update(visible=False)
|
151 |
|
152 |
def show_preview_from_url(url_input):
|
|
|
146 |
img = Image.open(file).convert("RGB")
|
147 |
return gr.update(value=img, visible=True), gr.update(visible=False)
|
148 |
elif path.endswith((".mp4", ".mov", ".avi")):
|
149 |
+
temp_video_dir = tempfile.mkdtemp()
|
150 |
+
safe_path = os.path.join(temp_video_dir, os.path.basename(path))
|
151 |
+
with open(safe_path, "wb") as f:
|
152 |
+
f.write(file.read())
|
153 |
+
return gr.update(visible=False), gr.update(value=safe_path, visible=True)
|
154 |
+
|
155 |
return gr.update(visible=False), gr.update(visible=False)
|
156 |
|
157 |
def show_preview_from_url(url_input):
|