Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
|
17 |
|
18 |
# Función para obtener la respuesta del modelo Gemini
|
19 |
def get_gemini_response(product_service, target_audience, main_benefit, tone_of_voice, temperature,
|
20 |
-
file_content="", image_parts=None, creative_approach=""
|
21 |
# Check if we have at least one source of information
|
22 |
has_file_content = bool(file_content.strip())
|
23 |
has_image = image_parts is not None
|
@@ -275,16 +275,30 @@ with col1:
|
|
275 |
st.error(f"Error al procesar la imagen: {str(e)}")
|
276 |
is_image = False
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
)
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
temperature = st.slider(
|
289 |
"Nivel de creatividad:",
|
290 |
min_value=0.0,
|
@@ -309,8 +323,8 @@ with col2:
|
|
309 |
temperature,
|
310 |
file_content,
|
311 |
image_parts,
|
312 |
-
st.session_state.get("selected_approach", "")
|
313 |
-
|
314 |
)
|
315 |
|
316 |
# Display the response if it exists in session state
|
@@ -337,27 +351,4 @@ with col2:
|
|
337 |
data=download_content,
|
338 |
file_name=f"conceptos_creativos_{timestamp}.txt",
|
339 |
mime="text/plain"
|
340 |
-
)
|
341 |
-
|
342 |
-
with st.expander("Opciones avanzadas"):
|
343 |
-
# Add creative approach selector
|
344 |
-
creative_approaches = {
|
345 |
-
"Analogías Cotidianas": "Usa objetos y situaciones del día a día para explicar tu producto",
|
346 |
-
"Contrastes Extremos": "Compara tu producto con algo completamente opuesto para destacar beneficios",
|
347 |
-
"Mundos Ficticios": "Usa referencias de películas, series o libros populares",
|
348 |
-
"Absurdo Lógico": "Crea conexiones inesperadas pero que tienen sentido al explicarlas",
|
349 |
-
"Inversión de Roles": "Presenta tu producto como si fuera el cliente, o el problema como la solución"
|
350 |
-
}
|
351 |
-
|
352 |
-
selected_approach = st.selectbox(
|
353 |
-
"Enfoque creativo:",
|
354 |
-
options=list(creative_approaches.keys()),
|
355 |
-
index=0,
|
356 |
-
key="approach_selectbox"
|
357 |
-
)
|
358 |
-
|
359 |
-
# Display the description of the selected approach
|
360 |
-
st.info(creative_approaches[selected_approach])
|
361 |
-
|
362 |
-
# Store the selected approach
|
363 |
-
st.session_state.selected_approach = selected_approach
|
|
|
17 |
|
18 |
# Función para obtener la respuesta del modelo Gemini
|
19 |
def get_gemini_response(product_service, target_audience, main_benefit, tone_of_voice, temperature,
|
20 |
+
file_content="", image_parts=None, creative_approach=""):
|
21 |
# Check if we have at least one source of information
|
22 |
has_file_content = bool(file_content.strip())
|
23 |
has_image = image_parts is not None
|
|
|
275 |
st.error(f"Error al procesar la imagen: {str(e)}")
|
276 |
is_image = False
|
277 |
|
278 |
+
|
279 |
+
# Add creative approach selector (moved outside nested expander)
|
280 |
+
creative_approaches = {
|
281 |
+
"Analogías Cotidianas": "Usa objetos y situaciones del día a día para explicar tu producto",
|
282 |
+
"Contrastes Extremos": "Compara tu producto con algo completamente opuesto para destacar beneficios",
|
283 |
+
"Mundos Ficticios": "Usa referencias de películas, series o libros populares",
|
284 |
+
"Absurdo Lógico": "Crea conexiones inesperadas pero que tienen sentido al explicarlas",
|
285 |
+
"Inversión de Roles": "Presenta tu producto como si fuera el cliente, o el problema como la solución"
|
286 |
+
}
|
287 |
+
|
288 |
+
selected_approach = st.selectbox(
|
289 |
+
"Enfoque creativo:",
|
290 |
+
options=list(creative_approaches.keys()),
|
291 |
+
index=0,
|
292 |
+
key="approach_selectbox"
|
293 |
)
|
294 |
|
295 |
+
# Display the description of the selected approach
|
296 |
+
st.info(creative_approaches[selected_approach])
|
297 |
+
|
298 |
+
# Store the selected approach
|
299 |
+
st.session_state.selected_approach = selected_approach
|
300 |
+
|
301 |
+
# Temperature slider
|
302 |
temperature = st.slider(
|
303 |
"Nivel de creatividad:",
|
304 |
min_value=0.0,
|
|
|
323 |
temperature,
|
324 |
file_content,
|
325 |
image_parts,
|
326 |
+
st.session_state.get("selected_approach", "")
|
327 |
+
# Removed contrast_level parameter
|
328 |
)
|
329 |
|
330 |
# Display the response if it exists in session state
|
|
|
351 |
data=download_content,
|
352 |
file_name=f"conceptos_creativos_{timestamp}.txt",
|
353 |
mime="text/plain"
|
354 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|