Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,8 @@ def get_gemini_response(input_prompt, formula_type, length, mood, target_audienc
|
|
19 |
|
20 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
21 |
full_prompt = f"""
|
22 |
-
You are a creative storyteller. Write
|
23 |
-
|
24 |
|
25 |
Target Audience: {target_audience}
|
26 |
Call to Action: {cta_type}
|
@@ -41,8 +41,9 @@ def get_gemini_response(input_prompt, formula_type, length, mood, target_audienc
|
|
41 |
- Write as a continuous narrative with natural paragraph breaks
|
42 |
- The story should flow naturally between sections without any visible structure markers
|
43 |
- DO NOT explain or mention the formula parts in the text
|
|
|
44 |
|
45 |
-
Format:
|
46 |
"""
|
47 |
response = model.generate_content([full_prompt])
|
48 |
return response.parts[0].text if response and response.parts else "Error al generar contenido."
|
@@ -89,5 +90,8 @@ with col2:
|
|
89 |
input_prompt, formula_type, length,
|
90 |
mood, target_audience, cta_type
|
91 |
)
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
19 |
|
20 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
21 |
full_prompt = f"""
|
22 |
+
You are a creative storyteller. Write THREE different {mood} stories in Spanish about "{input_prompt}" using everyday words and natural conversation.
|
23 |
+
Each story should use exactly {length} words.
|
24 |
|
25 |
Target Audience: {target_audience}
|
26 |
Call to Action: {cta_type}
|
|
|
41 |
- Write as a continuous narrative with natural paragraph breaks
|
42 |
- The story should flow naturally between sections without any visible structure markers
|
43 |
- DO NOT explain or mention the formula parts in the text
|
44 |
+
- Separate each story with "---"
|
45 |
|
46 |
+
Format: Three clean story texts with natural paragraphs, separated by "---", no labels, no explanations.
|
47 |
"""
|
48 |
response = model.generate_content([full_prompt])
|
49 |
return response.parts[0].text if response and response.parts else "Error al generar contenido."
|
|
|
90 |
input_prompt, formula_type, length,
|
91 |
mood, target_audience, cta_type
|
92 |
)
|
93 |
+
stories = response.split("---")
|
94 |
+
for i, story in enumerate(stories, 1):
|
95 |
+
st.subheader(f"Historia {i}:")
|
96 |
+
st.write(story.strip())
|
97 |
+
st.divider()
|