Spaces:
Running
Running
salomonsky
commited on
Commit
路
a5c316e
1
Parent(s):
4518eb6
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def generate_output(name, date_of_birth, image):
|
|
34 |
audio.export(audio_path, format="wav")
|
35 |
print("Archivo de audio generado:", audio_path)
|
36 |
except Exception as e:
|
37 |
-
return None, f"No se pudo generar el audio: {str(e)}"
|
38 |
|
39 |
command = f"python3 inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face {image} --audio audio.wav --outfile video.mp4 --nosmooth"
|
40 |
process = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
@@ -57,11 +57,14 @@ def error_message_fn(error_message):
|
|
57 |
|
58 |
def get_radio_labels():
|
59 |
image_paths = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg"]
|
|
|
60 |
image_choices = []
|
61 |
-
|
|
|
62 |
image = Image.open(image_path)
|
63 |
image.thumbnail((50, 50))
|
64 |
-
image_choices.append(image)
|
|
|
65 |
return image_choices
|
66 |
|
67 |
def select_image(image):
|
@@ -70,7 +73,7 @@ def select_image(image):
|
|
70 |
iface = gr.Interface(
|
71 |
fn=select_image,
|
72 |
inputs=[
|
73 |
-
gr.inputs.
|
74 |
gr.inputs.Textbox(lines=1, label="Nombre", placeholder="Ingresa tu nombre"),
|
75 |
gr.inputs.Textbox(lines=1, label="Fecha de Nacimiento", placeholder="DD/MM/AAAA")
|
76 |
],
|
|
|
34 |
audio.export(audio_path, format="wav")
|
35 |
print("Archivo de audio generado:", audio_path)
|
36 |
except Exception as e:
|
37 |
+
return None, f"No se pudo generar el audio: {str(e)}"
|
38 |
|
39 |
command = f"python3 inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face {image} --audio audio.wav --outfile video.mp4 --nosmooth"
|
40 |
process = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
57 |
|
58 |
def get_radio_labels():
|
59 |
image_paths = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg"]
|
60 |
+
image_labels = ["Andr茅a", "Roc铆o", "Ivana", "Georgina", "Sandra", "Liliana"]
|
61 |
image_choices = []
|
62 |
+
|
63 |
+
for image_path, image_label in zip(image_paths, image_labels):
|
64 |
image = Image.open(image_path)
|
65 |
image.thumbnail((50, 50))
|
66 |
+
image_choices.append((image, image_label))
|
67 |
+
|
68 |
return image_choices
|
69 |
|
70 |
def select_image(image):
|
|
|
73 |
iface = gr.Interface(
|
74 |
fn=select_image,
|
75 |
inputs=[
|
76 |
+
gr.inputs.Image(label="Selecciona una imagen:", type="pil", choices=get_radio_labels(), default=get_radio_labels()[0]),
|
77 |
gr.inputs.Textbox(lines=1, label="Nombre", placeholder="Ingresa tu nombre"),
|
78 |
gr.inputs.Textbox(lines=1, label="Fecha de Nacimiento", placeholder="DD/MM/AAAA")
|
79 |
],
|