Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ load_dotenv()
|
|
10 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
11 |
|
12 |
# Función para obtener la respuesta del modelo Gemini
|
13 |
-
def get_gemini_response(input_prompt, genre, length, language, mood, target_audience, cta_type
|
14 |
if not input_prompt:
|
15 |
return "Por favor, escribe un mensaje para generar contenido."
|
16 |
|
@@ -21,7 +21,9 @@ def get_gemini_response(input_prompt, genre, length, language, mood, target_audi
|
|
21 |
|
22 |
Target Audience: {target_audience}
|
23 |
CTA Type: {cta_type}
|
24 |
-
|
|
|
|
|
25 |
|
26 |
Structure:
|
27 |
1. Introduce a relatable problem that captures the audience's attention
|
@@ -33,7 +35,7 @@ def get_gemini_response(input_prompt, genre, length, language, mood, target_audi
|
|
33 |
- For PDF guide: Highlight how the guide provides steps to {benefit}
|
34 |
- For webinar: Emphasize how attending will teach them to {benefit}
|
35 |
|
36 |
-
Make the CTA feel natural and focus on the
|
37 |
|
38 |
### **Ejemplo de historia bien escrita:**
|
39 |
En una lejana galaxia, el maestro Xylo dictaba clases en la Tierra.
|
@@ -74,6 +76,7 @@ st.markdown("""
|
|
74 |
col1, col2 = st.columns([1, 1])
|
75 |
|
76 |
# Columna izquierda para inputs
|
|
|
77 |
with col1:
|
78 |
# Entrada de texto principal
|
79 |
input_prompt = st.text_area("Escribe de qué quieres que trate la historia:", placeholder="Escribe aquí tu idea...")
|
@@ -81,7 +84,7 @@ with col1:
|
|
81 |
# Campos de texto libre
|
82 |
target_audience = st.text_input("Público Objetivo:", placeholder="Ejemplo: Profesionales de 25-35 años interesados en tecnología...")
|
83 |
|
84 |
-
#
|
85 |
cta_type = st.selectbox("Tipo de llamado a la acción:", [
|
86 |
"Comprar producto",
|
87 |
"Descargar guía PDF",
|
@@ -106,7 +109,7 @@ with col2:
|
|
106 |
if generate_button:
|
107 |
response = get_gemini_response(
|
108 |
input_prompt, genre, length, language,
|
109 |
-
mood, target_audience, cta_type
|
110 |
)
|
111 |
st.subheader("Contenido generado:")
|
112 |
st.write(response)
|
|
|
10 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
11 |
|
12 |
# Función para obtener la respuesta del modelo Gemini
|
13 |
+
def get_gemini_response(input_prompt, genre, length, language, mood, target_audience, cta_type):
|
14 |
if not input_prompt:
|
15 |
return "Por favor, escribe un mensaje para generar contenido."
|
16 |
|
|
|
21 |
|
22 |
Target Audience: {target_audience}
|
23 |
CTA Type: {cta_type}
|
24 |
+
|
25 |
+
First, identify the main benefit that would resonate most with {target_audience} based on the story topic and CTA type.
|
26 |
+
Then, write a story that naturally leads to this benefit.
|
27 |
|
28 |
Structure:
|
29 |
1. Introduce a relatable problem that captures the audience's attention
|
|
|
35 |
- For PDF guide: Highlight how the guide provides steps to {benefit}
|
36 |
- For webinar: Emphasize how attending will teach them to {benefit}
|
37 |
|
38 |
+
Make the CTA feel natural and focus on the transformation they'll experience.
|
39 |
|
40 |
### **Ejemplo de historia bien escrita:**
|
41 |
En una lejana galaxia, el maestro Xylo dictaba clases en la Tierra.
|
|
|
76 |
col1, col2 = st.columns([1, 1])
|
77 |
|
78 |
# Columna izquierda para inputs
|
79 |
+
# Remove the benefit input field
|
80 |
with col1:
|
81 |
# Entrada de texto principal
|
82 |
input_prompt = st.text_area("Escribe de qué quieres que trate la historia:", placeholder="Escribe aquí tu idea...")
|
|
|
84 |
# Campos de texto libre
|
85 |
target_audience = st.text_input("Público Objetivo:", placeholder="Ejemplo: Profesionales de 25-35 años interesados en tecnología...")
|
86 |
|
87 |
+
# CTA type only
|
88 |
cta_type = st.selectbox("Tipo de llamado a la acción:", [
|
89 |
"Comprar producto",
|
90 |
"Descargar guía PDF",
|
|
|
109 |
if generate_button:
|
110 |
response = get_gemini_response(
|
111 |
input_prompt, genre, length, language,
|
112 |
+
mood, target_audience, cta_type
|
113 |
)
|
114 |
st.subheader("Contenido generado:")
|
115 |
st.write(response)
|