Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,8 +44,20 @@ def generate_benefits(focus_points, product, target_audience, creativity, num_bu
|
|
| 44 |
# Crear el prompt para el enfoque seleccionado
|
| 45 |
specific_prompt = prompt_base + f"\n\nEnfoque: {point}\n"
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# Generar los beneficios con la API de Google, pasando la temperatura (creatividad)
|
| 48 |
-
response = model.generate_content([specific_prompt]
|
| 49 |
|
| 50 |
if response and response.parts:
|
| 51 |
benefits.append(response.parts[0].text.strip())
|
|
|
|
| 44 |
# Crear el prompt para el enfoque seleccionado
|
| 45 |
specific_prompt = prompt_base + f"\n\nEnfoque: {point}\n"
|
| 46 |
|
| 47 |
+
# Configurar el modelo con par谩metros de generaci贸n
|
| 48 |
+
model = genai.GenerativeModel(
|
| 49 |
+
model_name="gemini-1.5-flash",
|
| 50 |
+
generation_config={
|
| 51 |
+
"temperature": creativity, # Usar la creatividad para definir la temperatura
|
| 52 |
+
"top_p": 0.65, # Probabilidad de tokens para mayor diversidad
|
| 53 |
+
"top_k": 280, # N煤mero de tokens que se consideran en cada paso
|
| 54 |
+
"max_output_tokens": 8196, # L铆mite m谩ximo de tokens generados
|
| 55 |
+
"response_mime_type": "text/plain", # Respuesta en texto plano
|
| 56 |
+
},
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
# Generar los beneficios con la API de Google, pasando la temperatura (creatividad)
|
| 60 |
+
response = model.generate_content([specific_prompt])
|
| 61 |
|
| 62 |
if response and response.parts:
|
| 63 |
benefits.append(response.parts[0].text.strip())
|