Update app.py
Browse files
app.py
CHANGED
@@ -457,7 +457,7 @@ KEY ELEMENTS TO INCLUDE:
|
|
457 |
STORY TOPIC INTEGRATION GUIDELINES:
|
458 |
- The story topic "{story_topic}" MUST be the central theme of the narrative
|
459 |
- Build the entire story around this specific topic/experience
|
460 |
-
- Use the topic as the
|
461 |
- Weave the product naturally into this specific narrative
|
462 |
- Ensure the story feels authentic to the given topic
|
463 |
- Maintain the emotional core of the topic throughout
|
@@ -553,17 +553,14 @@ IMPORTANT FINAL REMINDER:
|
|
553 |
story_instruction = f"{natural_instruction}\n\n{story_instruction}"
|
554 |
|
555 |
response = model.generate_content([story_instruction])
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
return f" {headline}\n\n{story}"
|
565 |
-
return story
|
566 |
-
raise ValueError("No se pudo generar la historia")
|
567 |
|
568 |
# Inicializar la aplicaci贸n Streamlit
|
569 |
st.set_page_config(page_title="Generador de Historias", page_icon=":pencil:", layout="wide")
|
@@ -695,4 +692,4 @@ with col2:
|
|
695 |
except ValueError as e:
|
696 |
st.error(f"Error: {str(e)}")
|
697 |
else:
|
698 |
-
st.error("Por favor, completa todos los campos requeridos (P煤blico objetivo, Producto y Acci贸n).")
|
|
|
457 |
STORY TOPIC INTEGRATION GUIDELINES:
|
458 |
- The story topic "{story_topic}" MUST be the central theme of the narrative
|
459 |
- Build the entire story around this specific topic/experience
|
460 |
+
- Use the topic as the first paragraph to capture attention
|
461 |
- Weave the product naturally into this specific narrative
|
462 |
- Ensure the story feels authentic to the given topic
|
463 |
- Maintain the emotional core of the topic throughout
|
|
|
553 |
story_instruction = f"{natural_instruction}\n\n{story_instruction}"
|
554 |
|
555 |
response = model.generate_content([story_instruction])
|
556 |
+
if response and response.parts:
|
557 |
+
story = response.parts[0].text.strip()
|
558 |
+
formula_types = ["GPS", "AIDA", "4U", "N煤merica Suprema"]
|
559 |
+
selected_formula = random.choice(formula_types)
|
560 |
+
headline = generate_headline_for_story(model, story, selected_formula, product, target_audience, mood)
|
561 |
+
if headline:
|
562 |
+
return f"{headline}\n\n{story}"
|
563 |
+
raise ValueError("No se pudo generar la historia")
|
|
|
|
|
|
|
564 |
|
565 |
# Inicializar la aplicaci贸n Streamlit
|
566 |
st.set_page_config(page_title="Generador de Historias", page_icon=":pencil:", layout="wide")
|
|
|
692 |
except ValueError as e:
|
693 |
st.error(f"Error: {str(e)}")
|
694 |
else:
|
695 |
+
st.error("Por favor, completa todos los campos requeridos (P煤blico objetivo, Producto y Acci贸n).")
|