Spaces:
Sleeping
Sleeping
Commit
路
ec6b0ee
1
Parent(s):
9369c96
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from pydub import AudioSegment
|
|
8 |
openai.api_key = os.environ.get("openai_api_key")
|
9 |
|
10 |
def generate_output(name, horoscope_type):
|
|
|
11 |
prompt = f"{name}, tu hor贸scopo {horoscope_type} y or谩culo de hoy es:"
|
12 |
response = openai.Completion.create(
|
13 |
engine="text-davinci-003",
|
@@ -33,7 +34,7 @@ def generate_output(name, horoscope_type):
|
|
33 |
except Exception as e:
|
34 |
return None, f"No se pudo generar el audio: {str(e)}"
|
35 |
|
36 |
-
command = f"python3 inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face
|
37 |
process = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
38 |
if process.returncode != 0:
|
39 |
error_message = process.stderr.decode("utf-8")
|
@@ -47,7 +48,7 @@ def generate_output(name, horoscope_type):
|
|
47 |
return None, "No se pudo generar el video"
|
48 |
|
49 |
name_input = gr.inputs.Textbox(lines=1, placeholder="Escribe tu Nombre Completo")
|
50 |
-
horoscope_type_radio = gr.inputs.Radio(["
|
51 |
output = gr.outputs.Video(label=None)
|
52 |
|
53 |
def generate_and_display_output(name, horoscope_type):
|
|
|
8 |
openai.api_key = os.environ.get("openai_api_key")
|
9 |
|
10 |
def generate_output(name, horoscope_type):
|
11 |
+
image_filename = f"{horoscope_type.lower()}.jpg" # Construye el nombre de la imagen
|
12 |
prompt = f"{name}, tu hor贸scopo {horoscope_type} y or谩culo de hoy es:"
|
13 |
response = openai.Completion.create(
|
14 |
engine="text-davinci-003",
|
|
|
34 |
except Exception as e:
|
35 |
return None, f"No se pudo generar el audio: {str(e)}"
|
36 |
|
37 |
+
command = f"python3 inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face {image_filename} --audio audio.wav --outfile video.mp4 --nosmooth"
|
38 |
process = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
39 |
if process.returncode != 0:
|
40 |
error_message = process.stderr.decode("utf-8")
|
|
|
48 |
return None, "No se pudo generar el video"
|
49 |
|
50 |
name_input = gr.inputs.Textbox(lines=1, placeholder="Escribe tu Nombre Completo")
|
51 |
+
horoscope_type_radio = gr.inputs.Radio(["Griego", "Egipcio", "Maya", "Chino", "Celta", "Hind煤"], label="Tipo de Hor贸scopo")
|
52 |
output = gr.outputs.Video(label=None)
|
53 |
|
54 |
def generate_and_display_output(name, horoscope_type):
|