Update app.py
Browse files
app.py
CHANGED
@@ -279,12 +279,11 @@ def generate_headline_for_story(model, story, formula_type, product, target_audi
|
|
279 |
Historia:
|
280 |
{story}
|
281 |
""")
|
282 |
-
|
283 |
response = model.generate_content([headline_prompt])
|
284 |
if response and response.parts:
|
285 |
return response.parts[0].text.strip()
|
286 |
return None
|
287 |
-
|
288 |
def generate_story(formula_type, target_audience, product, action, mood, length, story_topic=None):
|
289 |
"""Funci贸n unificada para generar historias"""
|
290 |
model = genai.GenerativeModel("gemini-2.0-flash")
|
@@ -512,8 +511,10 @@ IMPORTANT FINAL REMINDER:
|
|
512 |
response = model.generate_content([story_instruction])
|
513 |
if response and response.parts:
|
514 |
story = response.parts[0].text.strip()
|
515 |
-
# Generar el titular usando
|
516 |
-
|
|
|
|
|
517 |
# Combinar titular y historia
|
518 |
if headline:
|
519 |
return f"# {headline}\n\n{story}"
|
|
|
279 |
Historia:
|
280 |
{story}
|
281 |
""")
|
|
|
282 |
response = model.generate_content([headline_prompt])
|
283 |
if response and response.parts:
|
284 |
return response.parts[0].text.strip()
|
285 |
return None
|
286 |
+
|
287 |
def generate_story(formula_type, target_audience, product, action, mood, length, story_topic=None):
|
288 |
"""Funci贸n unificada para generar historias"""
|
289 |
model = genai.GenerativeModel("gemini-2.0-flash")
|
|
|
511 |
response = model.generate_content([story_instruction])
|
512 |
if response and response.parts:
|
513 |
story = response.parts[0].text.strip()
|
514 |
+
# Generar el titular usando una f贸rmula aleatoria
|
515 |
+
formula_types = ["GPS", "AIDA", "4U", "N煤merica Suprema"]
|
516 |
+
selected_formula = random.choice(formula_types)
|
517 |
+
headline = generate_headline_for_story(model, story, selected_formula, product, target_audience, mood)
|
518 |
# Combinar titular y historia
|
519 |
if headline:
|
520 |
return f"# {headline}\n\n{story}"
|