Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,28 +118,7 @@ def generate_story(formula_type, target_audience, product, action, mood, length,
|
|
| 118 |
if formula_type not in story_formulas:
|
| 119 |
raise ValueError("F贸rmula no v谩lida")
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
prompt = f"""{system_prompt}
|
| 124 |
-
|
| 125 |
-
Como experto copywriter, crea una historia persuasiva en espa帽ol de {length} palabras con un tono {mood}, siguiendo la estructura:
|
| 126 |
-
|
| 127 |
-
{formula_description}
|
| 128 |
-
|
| 129 |
-
P煤blico objetivo: {target_audience}
|
| 130 |
-
Producto/Servicio: {product}
|
| 131 |
-
Llamada a acci贸n: {action}
|
| 132 |
-
"""
|
| 133 |
-
|
| 134 |
-
if formula_type == "GHA" and story_topic:
|
| 135 |
-
prompt += f"\nTema de la historia: {story_topic}"
|
| 136 |
-
|
| 137 |
-
response = model.generate_content([prompt])
|
| 138 |
-
if response and response.parts:
|
| 139 |
-
return response.parts[0].text.strip()
|
| 140 |
-
raise ValueError("No se pudo generar la historia")
|
| 141 |
-
|
| 142 |
-
if formula_type == "PASA":
|
| 143 |
prompt = f"""
|
| 144 |
As a master copywriter and storyteller, craft a compelling {length}-word story in Spanish that follows the P.A.S.A. formula while maintaining a {mood} tone.
|
| 145 |
|
|
@@ -184,11 +163,26 @@ if formula_type == "PASA":
|
|
| 184 |
- Ensure call-to-action feels like a logical next step
|
| 185 |
- Use language that resonates with {target_audience}
|
| 186 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
# Inicializar la aplicaci贸n Streamlit
|
| 194 |
st.set_page_config(page_title="Generador de Historias", page_icon=":pencil:", layout="wide")
|
|
|
|
| 118 |
if formula_type not in story_formulas:
|
| 119 |
raise ValueError("F贸rmula no v谩lida")
|
| 120 |
|
| 121 |
+
if formula_type == "PASA":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
prompt = f"""
|
| 123 |
As a master copywriter and storyteller, craft a compelling {length}-word story in Spanish that follows the P.A.S.A. formula while maintaining a {mood} tone.
|
| 124 |
|
|
|
|
| 163 |
- Ensure call-to-action feels like a logical next step
|
| 164 |
- Use language that resonates with {target_audience}
|
| 165 |
"""
|
| 166 |
+
else:
|
| 167 |
+
formula_description = story_formulas[formula_type]["description"]
|
| 168 |
+
prompt = f"""{system_prompt}
|
| 169 |
+
|
| 170 |
+
Como experto copywriter, crea una historia persuasiva en espa帽ol de {length} palabras con un tono {mood}, siguiendo la estructura:
|
| 171 |
+
|
| 172 |
+
{formula_description}
|
| 173 |
|
| 174 |
+
P煤blico objetivo: {target_audience}
|
| 175 |
+
Producto/Servicio: {product}
|
| 176 |
+
Llamada a acci贸n: {action}
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
if formula_type == "GHA" and story_topic:
|
| 180 |
+
prompt += f"\nTema de la historia: {story_topic}"
|
| 181 |
+
|
| 182 |
+
response = model.generate_content([prompt])
|
| 183 |
+
if response and response.parts:
|
| 184 |
+
return response.parts[0].text.strip()
|
| 185 |
+
raise ValueError("No se pudo generar la historia")
|
| 186 |
|
| 187 |
# Inicializar la aplicaci贸n Streamlit
|
| 188 |
st.set_page_config(page_title="Generador de Historias", page_icon=":pencil:", layout="wide")
|