Update app.py
Browse files
app.py
CHANGED
|
@@ -2,11 +2,10 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import HfApi, hf_hub_download
|
| 5 |
-
import spaces
|
| 6 |
|
| 7 |
api = HfApi()
|
| 8 |
|
| 9 |
-
@spaces.GPU
|
| 10 |
def process_video(token, source_dataset, target_dataset, file_path):
|
| 11 |
if not token or not source_dataset or not target_dataset or not file_path:
|
| 12 |
return "❌ Error: Faltan datos obligatorios."
|
|
@@ -31,7 +30,7 @@ def process_video(token, source_dataset, target_dataset, file_path):
|
|
| 31 |
]
|
| 32 |
subprocess.run(command, check=True)
|
| 33 |
|
| 34 |
-
# 3. Subir el archivo ya reparado al dataset destino
|
| 35 |
api.upload_file(
|
| 36 |
path_or_fileobj=output_path,
|
| 37 |
path_in_repo=file_path,
|
|
@@ -48,16 +47,16 @@ def process_video(token, source_dataset, target_dataset, file_path):
|
|
| 48 |
except Exception as e:
|
| 49 |
return f"❌ Algo falló: {str(e)}"
|
| 50 |
|
| 51 |
-
# Interfaz gráfica adaptada
|
| 52 |
with gr.Blocks() as demo:
|
| 53 |
-
gr.Markdown("# 🛠️ Migrador y Reparador
|
| 54 |
-
gr.Markdown("Descarga el video malo
|
| 55 |
|
| 56 |
token_input = gr.Textbox(label="Tu HF_TOKEN (Con permisos de WRITE)", type="password")
|
| 57 |
|
| 58 |
with gr.Row():
|
| 59 |
-
source_input = gr.Textbox(label="Dataset ORIGEN
|
| 60 |
-
target_input = gr.Textbox(label="Dataset DESTINO
|
| 61 |
|
| 62 |
filepath_input = gr.Textbox(
|
| 63 |
label="Ruta exacta del archivo",
|
|
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import HfApi, hf_hub_download
|
|
|
|
| 5 |
|
| 6 |
api = HfApi()
|
| 7 |
|
| 8 |
+
# Quitamos @spaces.GPU porque FFmpeg corre excelente solo con CPU
|
| 9 |
def process_video(token, source_dataset, target_dataset, file_path):
|
| 10 |
if not token or not source_dataset or not target_dataset or not file_path:
|
| 11 |
return "❌ Error: Faltan datos obligatorios."
|
|
|
|
| 30 |
]
|
| 31 |
subprocess.run(command, check=True)
|
| 32 |
|
| 33 |
+
# 3. Subir el archivo ya reparado al dataset destino limpio
|
| 34 |
api.upload_file(
|
| 35 |
path_or_fileobj=output_path,
|
| 36 |
path_in_repo=file_path,
|
|
|
|
| 47 |
except Exception as e:
|
| 48 |
return f"❌ Algo falló: {str(e)}"
|
| 49 |
|
| 50 |
+
# Interfaz gráfica adaptada
|
| 51 |
with gr.Blocks() as demo:
|
| 52 |
+
gr.Markdown("# 🛠️ Migrador y Reparador v4 de MP4")
|
| 53 |
+
gr.Markdown("Descarga el video malo, lo repara y lo sube limpio al dataset nuevo usando la CPU (sin límites de GPU).")
|
| 54 |
|
| 55 |
token_input = gr.Textbox(label="Tu HF_TOKEN (Con permisos de WRITE)", type="password")
|
| 56 |
|
| 57 |
with gr.Row():
|
| 58 |
+
source_input = gr.Textbox(label="Dataset ORIGEN", value="xplhack1/bylatamsrc2")
|
| 59 |
+
target_input = gr.Textbox(label="Dataset DESTINO", value="orglatamsrc/latamsrcfixed")
|
| 60 |
|
| 61 |
filepath_input = gr.Textbox(
|
| 62 |
label="Ruta exacta del archivo",
|