Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,12 +21,19 @@ def get_model(temperature):
|
|
21 |
}
|
22 |
return genai.GenerativeModel('gemini-2.0-flash', generation_config=generation_config)
|
23 |
|
24 |
-
|
|
|
25 |
if not target_audience or not product:
|
26 |
return "Por favor, completa todos los campos requeridos."
|
27 |
|
28 |
model = get_model(temperature)
|
29 |
-
benefits_instruction = create_instruction(
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
response = model.generate_content([benefits_instruction], generation_config={"temperature": temperature})
|
32 |
return response.parts[0].text if response and response.parts else "Error generating content."
|
@@ -89,7 +96,7 @@ with col1:
|
|
89 |
submit = st.button("Generar Beneficios")
|
90 |
|
91 |
# Mostrar los beneficios generados
|
92 |
-
# Update the submit section
|
93 |
if submit:
|
94 |
if target_audience and product and selected_formula:
|
95 |
with st.spinner('Generando beneficios...'):
|
@@ -98,7 +105,8 @@ if submit:
|
|
98 |
target_audience,
|
99 |
product,
|
100 |
temperature,
|
101 |
-
selected_formula
|
|
|
102 |
)
|
103 |
if not isinstance(generated_benefits, str):
|
104 |
col2.error("Error al generar beneficios")
|
|
|
21 |
}
|
22 |
return genai.GenerativeModel('gemini-2.0-flash', generation_config=generation_config)
|
23 |
|
24 |
+
# Update the generate_benefits function to include selected_angle
|
25 |
+
def generate_benefits(number_of_benefits, target_audience, product, temperature, selected_formula, selected_angle):
|
26 |
if not target_audience or not product:
|
27 |
return "Por favor, completa todos los campos requeridos."
|
28 |
|
29 |
model = get_model(temperature)
|
30 |
+
benefits_instruction = create_instruction(
|
31 |
+
number_of_benefits,
|
32 |
+
target_audience,
|
33 |
+
product,
|
34 |
+
selected_formula,
|
35 |
+
selected_angle
|
36 |
+
)
|
37 |
|
38 |
response = model.generate_content([benefits_instruction], generation_config={"temperature": temperature})
|
39 |
return response.parts[0].text if response and response.parts else "Error generating content."
|
|
|
96 |
submit = st.button("Generar Beneficios")
|
97 |
|
98 |
# Mostrar los beneficios generados
|
99 |
+
# Update the submit section to include selected_angle
|
100 |
if submit:
|
101 |
if target_audience and product and selected_formula:
|
102 |
with st.spinner('Generando beneficios...'):
|
|
|
105 |
target_audience,
|
106 |
product,
|
107 |
temperature,
|
108 |
+
selected_formula,
|
109 |
+
selected_angle
|
110 |
)
|
111 |
if not isinstance(generated_benefits, str):
|
112 |
col2.error("Error al generar beneficios")
|