Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,11 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import HfApi, hf_hub_download
|
|
|
|
| 5 |
|
| 6 |
api = HfApi()
|
| 7 |
|
|
|
|
| 8 |
def process_video(token, dataset_id, file_path):
|
| 9 |
if not token or not file_path:
|
| 10 |
return "❌ Error: Faltan datos (Token o Ruta del archivo)."
|
|
@@ -45,8 +47,8 @@ def process_video(token, dataset_id, file_path):
|
|
| 45 |
except Exception as e:
|
| 46 |
return f"❌ Algo falló: {str(e)}"
|
| 47 |
|
| 48 |
-
# Interfaz gráfica de la herramienta
|
| 49 |
-
with gr.Blocks(
|
| 50 |
gr.Markdown("# 🛠️ Reparador de MP4 (moov atom fix)")
|
| 51 |
gr.Markdown("Esta herramienta descarga el TS falso, lo convierte a un MP4 real para web (faststart) y lo resube a tu dataset sin usar tu VPS.")
|
| 52 |
|
|
@@ -61,4 +63,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 61 |
|
| 62 |
btn.click(fn=process_video, inputs=[token_input, dataset_input, filepath_input], outputs=output)
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import HfApi, hf_hub_download
|
| 5 |
+
import spaces # <-- Importamos la librería de Spaces
|
| 6 |
|
| 7 |
api = HfApi()
|
| 8 |
|
| 9 |
+
@spaces.GPU # <-- Agregamos el decorador para que ZeroGPU nos deje arrancar
|
| 10 |
def process_video(token, dataset_id, file_path):
|
| 11 |
if not token or not file_path:
|
| 12 |
return "❌ Error: Faltan datos (Token o Ruta del archivo)."
|
|
|
|
| 47 |
except Exception as e:
|
| 48 |
return f"❌ Algo falló: {str(e)}"
|
| 49 |
|
| 50 |
+
# Interfaz gráfica de la herramienta (Corregido para Gradio 6.0)
|
| 51 |
+
with gr.Blocks() as demo:
|
| 52 |
gr.Markdown("# 🛠️ Reparador de MP4 (moov atom fix)")
|
| 53 |
gr.Markdown("Esta herramienta descarga el TS falso, lo convierte a un MP4 real para web (faststart) y lo resube a tu dataset sin usar tu VPS.")
|
| 54 |
|
|
|
|
| 63 |
|
| 64 |
btn.click(fn=process_video, inputs=[token_input, dataset_input, filepath_input], outputs=output)
|
| 65 |
|
| 66 |
+
# Movemos el tema aquí para que ya no te tire la advertencia amarilla
|
| 67 |
+
demo.launch(theme=gr.themes.Soft())
|