salomonsky commited on
Commit
ab14faa
1 Parent(s): e444e1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -21
app.py CHANGED
@@ -1,8 +1,9 @@
1
  import os
2
  import openai
3
- import gradio as gr
4
  import subprocess
5
  from gtts import gTTS
 
6
 
7
  openai.api_key = os.environ.get("openai_api_key")
8
 
@@ -43,27 +44,15 @@ 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
- def generate_and_display_output(name, birth_date):
 
 
 
52
  video_path, error_message = generate_output(name, birth_date)
53
  if error_message:
54
- print(f"Error: {error_message}")
55
- return None, error_message
56
  else:
57
- return video_path, None
58
-
59
- outputs = [output, error_output]
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 = os.environ.get("openai_api_key")
9
 
 
44
  return video_path, None
45
  return None, "No se pudo generar el video"
46
 
47
+ st.title("Generador de Hor贸scopos en Video")
 
 
 
48
 
49
+ name = st.text_input("Nombre", "Escribe tu nick (espera 60 segundos)
50
+ birth_date = st.text_input("Fecha de Nacimiento", "DD/MM/AAAA")
51
+
52
+ if st.button("Generar Video"):
53
  video_path, error_message = generate_output(name, birth_date)
54
  if error_message:
55
+ st.error(f"Error: {error_message}")
 
56
  else:
57
+ video_file = open(video_path, "rb").read()
58
+ st.video(video_file)