Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -54,14 +54,12 @@ def generate_bullets(number_of_bullets, target_audience, product, call_to_action
|
|
54 |
response = model.generate_content([system_instruction])
|
55 |
|
56 |
# Verificar que la respuesta tenga el formato esperado
|
57 |
-
if
|
58 |
-
|
|
|
|
|
|
|
59 |
|
60 |
-
if not response.candidates[0].content.parts:
|
61 |
-
raise ValueError("No se generaron partes válidas en la respuesta.")
|
62 |
-
|
63 |
-
generated_bullets = response.candidates[0].content.parts[0].text.strip()
|
64 |
-
return generated_bullets
|
65 |
except Exception as e:
|
66 |
st.error(f"Error al generar los bullets: {str(e)}")
|
67 |
raise
|
|
|
54 |
response = model.generate_content([system_instruction])
|
55 |
|
56 |
# Verificar que la respuesta tenga el formato esperado
|
57 |
+
if isinstance(response, tuple) and len(response) > 0:
|
58 |
+
generated_bullets = response[0].text.strip()
|
59 |
+
return generated_bullets
|
60 |
+
else:
|
61 |
+
raise ValueError("Respuesta inesperada del modelo.")
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
except Exception as e:
|
64 |
st.error(f"Error al generar los bullets: {str(e)}")
|
65 |
raise
|