Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ load_dotenv()
|
|
16 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
17 |
|
18 |
# Función para obtener la respuesta del modelo Gemini
|
19 |
-
def get_gemini_response(product_service, target_audience, main_benefit, tone_of_voice, temperature,
|
|
|
20 |
# Check if we have at least one source of information
|
21 |
has_file_content = bool(file_content.strip())
|
22 |
has_image = image_parts is not None
|
@@ -59,22 +60,22 @@ def get_gemini_response(product_service, target_audience, main_benefit, tone_of_
|
|
59 |
BUSINESS INFORMATION:
|
60 |
{business_info}
|
61 |
{reference_info}
|
62 |
-
|
63 |
A Creative Idea is a set of pieces created to sell a brand, product, or service, united by the same idea that is transmitted through a creative concept.
|
64 |
-
|
65 |
First, analyze (but don't output) these points:
|
66 |
1. TARGET AUDIENCE ANALYSIS:
|
67 |
- What everyday concepts are they familiar with?
|
68 |
- What TV shows, movies, or cultural references resonate with them?
|
69 |
- What emotions and experiences are meaningful to them?
|
70 |
- What mental images would be easy for them to recall?
|
71 |
-
|
72 |
2. PRODUCT/SERVICE ANALYSIS:
|
73 |
- What is the main benefit or promise?
|
74 |
- What makes it unique or different?
|
75 |
- What transformation does it offer?
|
76 |
- What process or journey does the customer go through?
|
77 |
-
|
78 |
Based on your internal analysis, create THREE different Creative Concepts in Spanish language.
|
79 |
Each concept should be a DIRECT ANALOGY or METAPHOR that connects your product/service to something completely different but familiar.
|
80 |
|
@@ -95,7 +96,9 @@ def get_gemini_response(product_service, target_audience, main_benefit, tone_of_
|
|
95 |
- Avoid technical jargon, complex words, or business terminology
|
96 |
- Write as if you're explaining to a friend in a casual conversation
|
97 |
- Use everyday objects, activities, movies, TV shows or cultural references everyone knows
|
98 |
-
- Make the connection
|
|
|
|
|
99 |
- Focus on the main benefit
|
100 |
- Create clear mental images
|
101 |
- Be easy to remember
|
@@ -105,37 +108,37 @@ def get_gemini_response(product_service, target_audience, main_benefit, tone_of_
|
|
105 |
Output EXACTLY in this format (no additional text) in Spanish language:
|
106 |
|
107 |
CONCEPTO CREATIVO 1:
|
108 |
-
|
109 |
Concepto:
|
110 |
[Main message/benefit in simple, conversational language]
|
111 |
-
|
112 |
Creatividad:
|
113 |
[Direct analogy using everyday language: "X es como Y porque Z"]
|
114 |
-
|
115 |
Ejemplo de Titular:
|
116 |
[Short headline example applying the creative concept]
|
117 |
-
|
118 |
-
|
119 |
CONCEPTO CREATIVO 2:
|
120 |
-
|
121 |
Concepto:
|
122 |
[Main message/benefit]
|
123 |
-
|
124 |
Creatividad:
|
125 |
[Direct analogy: "X es como Y porque Z"]
|
126 |
-
|
127 |
Ejemplo de Titular:
|
128 |
[Short headline example applying the creative concept]
|
129 |
-
|
130 |
-
|
131 |
CONCEPTO CREATIVO 3:
|
132 |
-
|
133 |
Concepto:
|
134 |
[Main message/benefit]
|
135 |
-
|
136 |
Creatividad:
|
137 |
[Direct analogy: "X es como Y porque Z"]
|
138 |
-
|
139 |
Ejemplo de Titular:
|
140 |
[Short headline example applying the creative concept]
|
141 |
"""
|
@@ -272,6 +275,16 @@ with col1:
|
|
272 |
st.error(f"Error al procesar la imagen: {str(e)}")
|
273 |
is_image = False
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
temperature = st.slider(
|
276 |
"Nivel de creatividad:",
|
277 |
min_value=0.0,
|
@@ -295,7 +308,9 @@ with col2:
|
|
295 |
tone_of_voice,
|
296 |
temperature,
|
297 |
file_content,
|
298 |
-
image_parts
|
|
|
|
|
299 |
)
|
300 |
|
301 |
# Display the response if it exists in session state
|
@@ -322,4 +337,27 @@ with col2:
|
|
322 |
data=download_content,
|
323 |
file_name=f"conceptos_creativos_{timestamp}.txt",
|
324 |
mime="text/plain"
|
325 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
17 |
|
18 |
# Función para obtener la respuesta del modelo Gemini
|
19 |
+
def get_gemini_response(product_service, target_audience, main_benefit, tone_of_voice, temperature,
|
20 |
+
file_content="", image_parts=None, creative_approach="", contrast_level=3):
|
21 |
# Check if we have at least one source of information
|
22 |
has_file_content = bool(file_content.strip())
|
23 |
has_image = image_parts is not None
|
|
|
60 |
BUSINESS INFORMATION:
|
61 |
{business_info}
|
62 |
{reference_info}
|
63 |
+
|
64 |
A Creative Idea is a set of pieces created to sell a brand, product, or service, united by the same idea that is transmitted through a creative concept.
|
65 |
+
|
66 |
First, analyze (but don't output) these points:
|
67 |
1. TARGET AUDIENCE ANALYSIS:
|
68 |
- What everyday concepts are they familiar with?
|
69 |
- What TV shows, movies, or cultural references resonate with them?
|
70 |
- What emotions and experiences are meaningful to them?
|
71 |
- What mental images would be easy for them to recall?
|
72 |
+
|
73 |
2. PRODUCT/SERVICE ANALYSIS:
|
74 |
- What is the main benefit or promise?
|
75 |
- What makes it unique or different?
|
76 |
- What transformation does it offer?
|
77 |
- What process or journey does the customer go through?
|
78 |
+
|
79 |
Based on your internal analysis, create THREE different Creative Concepts in Spanish language.
|
80 |
Each concept should be a DIRECT ANALOGY or METAPHOR that connects your product/service to something completely different but familiar.
|
81 |
|
|
|
96 |
- Avoid technical jargon, complex words, or business terminology
|
97 |
- Write as if you're explaining to a friend in a casual conversation
|
98 |
- Use everyday objects, activities, movies, TV shows or cultural references everyone knows
|
99 |
+
- Make the connection SURPRISING and UNEXPECTED - connect things that normally wouldn't be connected
|
100 |
+
- Challenge conventional thinking by finding parallels between your product and something completely different
|
101 |
+
- Create analogies that make people say "I never thought of it that way!"
|
102 |
- Focus on the main benefit
|
103 |
- Create clear mental images
|
104 |
- Be easy to remember
|
|
|
108 |
Output EXACTLY in this format (no additional text) in Spanish language:
|
109 |
|
110 |
CONCEPTO CREATIVO 1:
|
111 |
+
|
112 |
Concepto:
|
113 |
[Main message/benefit in simple, conversational language]
|
114 |
+
|
115 |
Creatividad:
|
116 |
[Direct analogy using everyday language: "X es como Y porque Z"]
|
117 |
+
|
118 |
Ejemplo de Titular:
|
119 |
[Short headline example applying the creative concept]
|
120 |
+
|
121 |
+
|
122 |
CONCEPTO CREATIVO 2:
|
123 |
+
|
124 |
Concepto:
|
125 |
[Main message/benefit]
|
126 |
+
|
127 |
Creatividad:
|
128 |
[Direct analogy: "X es como Y porque Z"]
|
129 |
+
|
130 |
Ejemplo de Titular:
|
131 |
[Short headline example applying the creative concept]
|
132 |
+
|
133 |
+
|
134 |
CONCEPTO CREATIVO 3:
|
135 |
+
|
136 |
Concepto:
|
137 |
[Main message/benefit]
|
138 |
+
|
139 |
Creatividad:
|
140 |
[Direct analogy: "X es como Y porque Z"]
|
141 |
+
|
142 |
Ejemplo de Titular:
|
143 |
[Short headline example applying the creative concept]
|
144 |
"""
|
|
|
275 |
st.error(f"Error al procesar la imagen: {str(e)}")
|
276 |
is_image = False
|
277 |
|
278 |
+
# Add contrast parameter
|
279 |
+
contrast_level = st.slider(
|
280 |
+
"Nivel de contraste:",
|
281 |
+
min_value=1,
|
282 |
+
max_value=5,
|
283 |
+
value=3,
|
284 |
+
step=1,
|
285 |
+
help="Valores más altos generan analogías entre conceptos más distantes y sorprendentes."
|
286 |
+
)
|
287 |
+
|
288 |
temperature = st.slider(
|
289 |
"Nivel de creatividad:",
|
290 |
min_value=0.0,
|
|
|
308 |
tone_of_voice,
|
309 |
temperature,
|
310 |
file_content,
|
311 |
+
image_parts,
|
312 |
+
st.session_state.get("selected_approach", ""),
|
313 |
+
contrast_level if 'contrast_level' in locals() else 3
|
314 |
)
|
315 |
|
316 |
# Display the response if it exists in session state
|
|
|
337 |
data=download_content,
|
338 |
file_name=f"conceptos_creativos_{timestamp}.txt",
|
339 |
mime="text/plain"
|
340 |
+
)
|
341 |
+
|
342 |
+
with st.expander("Opciones avanzadas"):
|
343 |
+
# Add creative approach selector
|
344 |
+
creative_approaches = {
|
345 |
+
"Analogías Cotidianas": "Usa objetos y situaciones del día a día para explicar tu producto",
|
346 |
+
"Contrastes Extremos": "Compara tu producto con algo completamente opuesto para destacar beneficios",
|
347 |
+
"Mundos Ficticios": "Usa referencias de películas, series o libros populares",
|
348 |
+
"Absurdo Lógico": "Crea conexiones inesperadas pero que tienen sentido al explicarlas",
|
349 |
+
"Inversión de Roles": "Presenta tu producto como si fuera el cliente, o el problema como la solución"
|
350 |
+
}
|
351 |
+
|
352 |
+
selected_approach = st.selectbox(
|
353 |
+
"Enfoque creativo:",
|
354 |
+
options=list(creative_approaches.keys()),
|
355 |
+
index=0,
|
356 |
+
key="approach_selectbox"
|
357 |
+
)
|
358 |
+
|
359 |
+
# Display the description of the selected approach
|
360 |
+
st.info(creative_approaches[selected_approach])
|
361 |
+
|
362 |
+
# Store the selected approach
|
363 |
+
st.session_state.selected_approach = selected_approach
|