JeCabrera commited on
Commit
412a4bc
·
verified ·
1 Parent(s): f592a63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -73,7 +73,7 @@ st.markdown("<h3 style='text-align: center;'>Convierte tus ideas en historias in
73
  st.markdown("""
74
  <style>
75
  div.stButton > button {
76
- background-color: #00ed11; /* Color llamativo */
77
  color: black; /* Texto en negro */
78
  width: 90%;
79
  height: 60px;
@@ -95,6 +95,9 @@ st.markdown("""
95
  # Create two columns for layout (40% and 60%)
96
  col1, col2 = st.columns([2, 3]) # 2 + 3 = 5 parts total
97
 
 
 
 
98
  with col1:
99
  # Subir imagen primero
100
  uploaded_file = st.file_uploader("Elegir una imagen...", type=["jpg", "jpeg", "png"])
@@ -104,18 +107,28 @@ with col1:
104
  input_prompt = st.text_input("Escribe de qué quieres que trate tu historia (opcional):", placeholder="Escribe tu mensaje aquí...")
105
  genre = st.selectbox("Tipo de texto:", ["Historia", "Shayari", "Sher", "Poema", "Cita"])
106
  length = st.selectbox("Longitud del texto:", ["Corto", "Largo"])
107
- language = st.selectbox("Idioma del texto:", ["Inglés", "Español"])
108
  mood = st.selectbox("Estado de ánimo:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
109
 
110
  # Generate button con el nuevo estilo, centrado y ajustado
111
  submit = st.button("Escribir mi historia")
112
 
 
 
 
 
 
 
 
 
 
 
113
  # Display uploaded image
114
  if uploaded_file is not None:
115
  image = Image.open(uploaded_file)
116
  col1.image(image, caption="Imagen subida", use_column_width=True)
117
 
118
- # Handling the button click
119
  if submit:
120
  if uploaded_file or input_prompt:
121
  try:
 
73
  st.markdown("""
74
  <style>
75
  div.stButton > button {
76
+ background-color: #FFCC00; /* Color llamativo */
77
  color: black; /* Texto en negro */
78
  width: 90%;
79
  height: 60px;
 
95
  # Create two columns for layout (40% and 60%)
96
  col1, col2 = st.columns([2, 3]) # 2 + 3 = 5 parts total
97
 
98
+ # Variables para valores predeterminados
99
+ default_language = "Español"
100
+
101
  with col1:
102
  # Subir imagen primero
103
  uploaded_file = st.file_uploader("Elegir una imagen...", type=["jpg", "jpeg", "png"])
 
107
  input_prompt = st.text_input("Escribe de qué quieres que trate tu historia (opcional):", placeholder="Escribe tu mensaje aquí...")
108
  genre = st.selectbox("Tipo de texto:", ["Historia", "Shayari", "Sher", "Poema", "Cita"])
109
  length = st.selectbox("Longitud del texto:", ["Corto", "Largo"])
110
+ language = st.selectbox("Idioma del texto:", ["Inglés", "Español"], index=1) # Español por defecto
111
  mood = st.selectbox("Estado de ánimo:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
112
 
113
  # Generate button con el nuevo estilo, centrado y ajustado
114
  submit = st.button("Escribir mi historia")
115
 
116
+ # Reset button
117
+ if st.button("Reiniciar valores"):
118
+ uploaded_file = None
119
+ input_prompt = ""
120
+ genre = "Historia"
121
+ length = "Corto"
122
+ language = "Español" # Reiniciar a Español
123
+ mood = "Emocional"
124
+ st.experimental_rerun() # Reiniciar la app
125
+
126
  # Display uploaded image
127
  if uploaded_file is not None:
128
  image = Image.open(uploaded_file)
129
  col1.image(image, caption="Imagen subida", use_column_width=True)
130
 
131
+ # Handle submit action
132
  if submit:
133
  if uploaded_file or input_prompt:
134
  try: