Spaces:
Sleeping
Sleeping
Commit
路
5c68285
1
Parent(s):
51f45b8
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,14 @@
|
|
1 |
-
import os
|
|
|
2 |
import gradio as gr
|
3 |
import subprocess
|
4 |
from gtts import gTTS
|
5 |
from pydub import AudioSegment
|
6 |
|
7 |
-
|
8 |
-
"Griego": "griego.jpg",
|
9 |
-
"Egipcio": "egipcio.jpg",
|
10 |
-
"Maya": "maya.jpg",
|
11 |
-
"Chino": "chino.jpg",
|
12 |
-
"Celta": "celta.jpg",
|
13 |
-
"Hindu": "hindu.jpg"
|
14 |
-
}
|
15 |
-
|
16 |
-
name_input = gr.inputs.Textbox(lines=1, placeholder="Escribe tu Nombre Completo")
|
17 |
-
horoscope_type_radio = gr.inputs.Radio(["Griego", "Egipcio", "Maya", "Chino", "Celta", "Hindu"], label="Tipo de Hor贸scopo")
|
18 |
-
output = gr.outputs.Video(label=None)
|
19 |
|
20 |
def generate_output(name, horoscope_type):
|
21 |
-
image_filename =
|
22 |
prompt = f"{name}, tu hor贸scopo {horoscope_type} y or谩culo de hoy es:"
|
23 |
response = openai.Completion.create(
|
24 |
engine="text-davinci-003",
|
@@ -57,6 +47,10 @@ def generate_output(name, horoscope_type):
|
|
57 |
return output_video_path, None
|
58 |
return None, "No se pudo generar el video"
|
59 |
|
|
|
|
|
|
|
|
|
60 |
def generate_and_display_output(name, horoscope_type):
|
61 |
video_path, error_message = generate_output(name, horoscope_type)
|
62 |
if error_message:
|
@@ -71,8 +65,7 @@ iface = gr.Interface(
|
|
71 |
title="Hor贸scopo con Inteligencia Artificial v2.1",
|
72 |
description="Ingresa tu nombre y selecciona el tipo de hor贸scopo.",
|
73 |
layout="vertical",
|
74 |
-
theme="dark"
|
75 |
-
examples=[],
|
76 |
)
|
77 |
|
78 |
iface.launch()
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
import gradio as gr
|
4 |
import subprocess
|
5 |
from gtts import gTTS
|
6 |
from pydub import AudioSegment
|
7 |
|
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",
|
|
|
47 |
return output_video_path, None
|
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", "Hindu"], label="Tipo de Hor贸scopo")
|
52 |
+
output = gr.outputs.Video(label=None)
|
53 |
+
|
54 |
def generate_and_display_output(name, horoscope_type):
|
55 |
video_path, error_message = generate_output(name, horoscope_type)
|
56 |
if error_message:
|
|
|
65 |
title="Hor贸scopo con Inteligencia Artificial v2.1",
|
66 |
description="Ingresa tu nombre y selecciona el tipo de hor贸scopo.",
|
67 |
layout="vertical",
|
68 |
+
theme="dark"
|
|
|
69 |
)
|
70 |
|
71 |
iface.launch()
|