Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -74,23 +74,23 @@ col1, col2 = st.columns([2, 3]) # 2 + 3 = 5 parts total
|
|
74 |
|
75 |
with col1:
|
76 |
# Subir imagen primero
|
77 |
-
uploaded_file = st.file_uploader("
|
78 |
|
79 |
-
# Agrupar opciones en un desplegable
|
80 |
-
with st.expander("
|
81 |
-
input_prompt = st.text_input("
|
82 |
-
genre = st.selectbox("
|
83 |
-
length = st.selectbox("
|
84 |
-
language = st.selectbox("
|
85 |
-
mood = st.selectbox("
|
86 |
|
87 |
# Generate button (fuera del desplegable)
|
88 |
-
submit = st.button("
|
89 |
|
90 |
# Display uploaded image
|
91 |
if uploaded_file is not None:
|
92 |
image = Image.open(uploaded_file)
|
93 |
-
col1.image(image, caption="
|
94 |
|
95 |
# Handle submit action
|
96 |
if submit:
|
@@ -98,9 +98,9 @@ if submit:
|
|
98 |
try:
|
99 |
image_data = input_image_setup(uploaded_file)
|
100 |
response = get_gemini_response(input_prompt, image_data, genre, length, language, mood)
|
101 |
-
col2.subheader("
|
102 |
col2.write(response)
|
103 |
except ValueError as e:
|
104 |
col2.error(f"Error: {str(e)}")
|
105 |
else:
|
106 |
-
col2.error("
|
|
|
74 |
|
75 |
with col1:
|
76 |
# Subir imagen primero
|
77 |
+
uploaded_file = st.file_uploader("Elegir una imagen...", type=["jpg", "jpeg", "png"])
|
78 |
|
79 |
+
# Agrupar opciones en un desplegable con un nuevo título
|
80 |
+
with st.expander("Clic para personalizar tu historia", expanded=False): # El desplegable está cerrado por defecto
|
81 |
+
input_prompt = st.text_input("Escribe de qué quieres que trate tu historia (opcional):", placeholder="Escribe tu mensaje aquí...")
|
82 |
+
genre = st.selectbox("Tipo de texto:", ["Historia", "Shayari", "Sher", "Poema", "Cita"])
|
83 |
+
length = st.selectbox("Longitud del texto:", ["Corto", "Largo"])
|
84 |
+
language = st.selectbox("Idioma del texto:", ["Inglés", "Español"])
|
85 |
+
mood = st.selectbox("Estado de ánimo:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
|
86 |
|
87 |
# Generate button (fuera del desplegable)
|
88 |
+
submit = st.button("Generar")
|
89 |
|
90 |
# Display uploaded image
|
91 |
if uploaded_file is not None:
|
92 |
image = Image.open(uploaded_file)
|
93 |
+
col1.image(image, caption="Imagen subida", use_column_width=True)
|
94 |
|
95 |
# Handle submit action
|
96 |
if submit:
|
|
|
98 |
try:
|
99 |
image_data = input_image_setup(uploaded_file)
|
100 |
response = get_gemini_response(input_prompt, image_data, genre, length, language, mood)
|
101 |
+
col2.subheader("Contenido generado:")
|
102 |
col2.write(response)
|
103 |
except ValueError as e:
|
104 |
col2.error(f"Error: {str(e)}")
|
105 |
else:
|
106 |
+
col2.error("Por favor, sube una imagen o proporciona un mensaje.")
|