Spaces:
Running
Running
Commit
·
2da8087
1
Parent(s):
e444e1f
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import os
|
2 |
import openai
|
3 |
-
import
|
4 |
import subprocess
|
5 |
from gtts import gTTS
|
|
|
6 |
|
7 |
-
openai.api_key =
|
8 |
|
9 |
def generate_output(name, birth_date):
|
10 |
if not birth_date:
|
@@ -43,27 +44,17 @@ def generate_output(name, birth_date):
|
|
43 |
return video_path, None
|
44 |
return None, "No se pudo generar el video"
|
45 |
|
46 |
-
name_input = gr.components.Textbox(lines=1, placeholder="Escribe tu nombre", label="Nombre")
|
47 |
-
birth_date_input = gr.components.Textbox(lines=1, placeholder="Fecha de Nacimiento - DD/MM/AAAA", label="Fecha de Nacimiento")
|
48 |
-
output = gr.components.Video(label="Resultado", type="mp4")
|
49 |
-
error_output = gr.components.Textbox(label="Errores")
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
52 |
video_path, error_message = generate_output(name, birth_date)
|
53 |
if error_message:
|
54 |
-
|
55 |
-
return None, error_message
|
56 |
else:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
iface = gr.Interface(
|
62 |
-
fn=generate_and_display_output,
|
63 |
-
inputs=[name_input, birth_date_input],
|
64 |
-
outputs=outputs,
|
65 |
-
layout="vertical",
|
66 |
-
theme="dark"
|
67 |
-
)
|
68 |
-
|
69 |
-
iface.launch()
|
|
|
1 |
import os
|
2 |
import openai
|
3 |
+
import streamlit as st
|
4 |
import subprocess
|
5 |
from gtts import gTTS
|
6 |
+
import cv2
|
7 |
|
8 |
+
openai.api_key = "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"
|
9 |
|
10 |
def generate_output(name, birth_date):
|
11 |
if not birth_date:
|
|
|
44 |
return video_path, None
|
45 |
return None, "No se pudo generar el video"
|
46 |
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
st.title("Generador de Horóscopos en Video")
|
49 |
+
|
50 |
+
name = st.text_input("Nombre", "Escribe tu nick")
|
51 |
+
birth_date = st.text_input("Fecha de Nacimiento", "DD/MM/AAAA")
|
52 |
+
|
53 |
+
if st.button("Generar Video"):
|
54 |
video_path, error_message = generate_output(name, birth_date)
|
55 |
if error_message:
|
56 |
+
st.error(f"Error: {error_message}")
|
|
|
57 |
else:
|
58 |
+
# Mostrar el video usando Streamlit
|
59 |
+
video_file = open(video_path, "rb").read()
|
60 |
+
st.video(video_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|