Spaces:
Runtime error
Runtime error
Update core/input_handler.py
Browse files- core/input_handler.py +0 -23
core/input_handler.py
CHANGED
|
@@ -119,29 +119,6 @@ def validate_video(path):
|
|
| 119 |
except Exception as e:
|
| 120 |
logger.error(f"Error validating video: {e}")
|
| 121 |
return False, str(e)
|
| 122 |
-
|
| 123 |
-
def show_preview_from_upload(files):
|
| 124 |
-
if not files or len(files) == 0:
|
| 125 |
-
return gr.update(visible=False), gr.update(visible=False)
|
| 126 |
-
file = files[0]
|
| 127 |
-
file_path = file.name.lower()
|
| 128 |
-
if file_path.endswith((".png", ".jpg", ".jpeg", ".webp")):
|
| 129 |
-
pil_image = Image.open(file).convert("RGB")
|
| 130 |
-
return gr.update(value=pil_image, visible=True), gr.update(visible=False)
|
| 131 |
-
elif file_path.endswith((".mp4", ".mov", ".avi")):
|
| 132 |
-
return gr.update(visible=False), gr.update(value=file.name, visible=True)
|
| 133 |
-
return gr.update(visible=False), gr.update(visible=False)
|
| 134 |
-
|
| 135 |
-
def show_preview_from_url(url_input):
|
| 136 |
-
if not url_input:
|
| 137 |
-
return gr.update(visible=False), gr.update(visible=False)
|
| 138 |
-
url_lower = url_input.strip().lower()
|
| 139 |
-
if url_lower.endswith((".png", ".jpg", ".jpeg", ".webp")):
|
| 140 |
-
return gr.update(value=url_input, visible=True), gr.update(visible=False)
|
| 141 |
-
elif url_lower.endswith((".mp4", ".mov", ".avi")):
|
| 142 |
-
return gr.update(visible=False), gr.update(value=url_input, visible=True)
|
| 143 |
-
return gr.update(visible=False), gr.update(visible=False)
|
| 144 |
-
|
| 145 |
|
| 146 |
# Input Resolution
|
| 147 |
def resolve_input(mode, media_upload, url):
|
|
|
|
| 119 |
except Exception as e:
|
| 120 |
logger.error(f"Error validating video: {e}")
|
| 121 |
return False, str(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
# Input Resolution
|
| 124 |
def resolve_input(mode, media_upload, url):
|