JeCabrera commited on
Commit
d7768e9
verified
1 Parent(s): 83edbb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -16
app.py CHANGED
@@ -19,11 +19,11 @@ def get_random_call_to_action():
19
  # Crear la instrucci贸n para la llamada a la acci贸n seg煤n la opci贸n seleccionada
20
  def get_call_to_action_instruction(action_call):
21
  if action_call == "Directo":
22
- return "Incorporate a clear and direct call to action that motivates the reader to act immediately. The call should be compelling and highlight the urgency of taking action."
23
  elif action_call == "Sutil":
24
- return "Suggest a call to action subtly, hinting at the benefits of acting without being too obvious. The reader should feel like they are making the decision on their own."
25
  elif action_call == "Indirecto":
26
- return "Present a call to action indirectly, creating a scenario where the reader can see the action as a natural solution to their problems without naming it explicitly."
27
  return ""
28
 
29
  # System Prompt - Instrucci贸n en ingl茅s para el modelo
@@ -33,19 +33,12 @@ Generate unusual, creative, and fascinating bullets that capture readers' attent
33
  """
34
 
35
  # Funci贸n para obtener una cantidad de bullets
36
- def get_gemini_response_bullets(target_audience, num_bullets, creativity):
37
- action_call = get_random_call_to_action() # Obtener la llamada a la acci贸n aleatoria
38
  call_to_action_instruction = get_call_to_action_instruction(action_call) # Definir la instrucci贸n aqu铆
39
  model_choice = "gemini-1.5-flash" # Modelo por defecto
40
 
41
  model = genai.GenerativeModel(model_choice)
42
 
43
- # System Prompt - Instrucci贸n en ingl茅s para el modelo
44
- system_instruction = """
45
- You are a world-class copywriter, expert in creating benefits that connect symptoms with problems. You deeply understand the emotions, desires, and challenges of a specific audience, allowing you to design personalized marketing strategies that resonate and motivate action. You know how to use proven structures to attract your target audience, generating interest and creating a powerful connection.
46
- Generate unusual, creative, and fascinating bullets that subtly hint at the product without direct mention, capturing readers' attention. Respond in Spanish and use a numbered list format. Important: Never include explanations or categories, like this: 'La leyenda del padre soltero: Dice que nunca hay tiempo suficiente. El yoga te ense帽a a usar mejor el tiempo que tienes, incluso cuando te parece imposible.'.
47
- """
48
-
49
  # Crear el prompt para generar bullets
50
  full_prompt = f"""
51
  {system_instruction}
@@ -59,10 +52,6 @@ def get_gemini_response_bullets(target_audience, num_bullets, creativity):
59
  * Asking a Question: 'Did you know that...'
60
  * When: 'When is it a good idea to tell a girl you like her? If you don't say it at that moment, say goodbye to getting to know her intimately.'
61
  Use the following mention instructions to guide your writing: {call_to_action_instruction}
62
- Using the mention type '{action_call}' to guide how to suggest the call to action in the benefits or bullets. Ensure to adapt your writing based on this mention type:
63
- - Direct: Clearly highlight the action the reader should take as the solution.
64
- - Subtle: Suggest the action without naming it directly.
65
- - Indirect: Present the action in a way that feels natural and inevitable without stating it explicitly.
66
  Additionally, subtly mention the product '{product}' in the bullets without making it the focus. The connection between the action and the product should feel organic and seamless.
67
  Please create the bullets now.
68
  """
@@ -116,6 +105,9 @@ with col1:
116
  num_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)
117
  creativity = st.selectbox("Creatividad", ["Alta", "Media", "Baja"])
118
 
 
 
 
119
  # Bot贸n de enviar
120
  submit = st.button("Generar Bullets")
121
 
@@ -124,7 +116,7 @@ if submit:
124
  if target_audience:
125
  try:
126
  # Obtener la respuesta del modelo
127
- generated_bullets = get_gemini_response_bullets(target_audience, num_bullets, creativity) # Sin menci贸n del producto
128
  col2.markdown(f"""
129
  <div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;">
130
  <h4>Mira la magia:</h4>
 
19
  # Crear la instrucci贸n para la llamada a la acci贸n seg煤n la opci贸n seleccionada
20
  def get_call_to_action_instruction(action_call):
21
  if action_call == "Directo":
22
+ return "Incorpora una llamada a la acci贸n clara y directa que motive al lector a actuar de inmediato. La llamada debe ser convincente y destacar la urgencia de tomar acci贸n."
23
  elif action_call == "Sutil":
24
+ return "Sugiere una llamada a la acci贸n de manera sutil, insinuando los beneficios de actuar sin ser demasiado obvio. El lector debe sentir que est谩 tomando la decisi贸n por su cuenta."
25
  elif action_call == "Indirecto":
26
+ return "Presenta una llamada a la acci贸n de forma indirecta, creando un escenario donde el lector pueda ver la acci贸n como una soluci贸n natural a sus problemas sin nombrarla expl铆citamente."
27
  return ""
28
 
29
  # System Prompt - Instrucci贸n en ingl茅s para el modelo
 
33
  """
34
 
35
  # Funci贸n para obtener una cantidad de bullets
36
+ def get_gemini_response_bullets(target_audience, num_bullets, creativity, action_call):
 
37
  call_to_action_instruction = get_call_to_action_instruction(action_call) # Definir la instrucci贸n aqu铆
38
  model_choice = "gemini-1.5-flash" # Modelo por defecto
39
 
40
  model = genai.GenerativeModel(model_choice)
41
 
 
 
 
 
 
 
42
  # Crear el prompt para generar bullets
43
  full_prompt = f"""
44
  {system_instruction}
 
52
  * Asking a Question: 'Did you know that...'
53
  * When: 'When is it a good idea to tell a girl you like her? If you don't say it at that moment, say goodbye to getting to know her intimately.'
54
  Use the following mention instructions to guide your writing: {call_to_action_instruction}
 
 
 
 
55
  Additionally, subtly mention the product '{product}' in the bullets without making it the focus. The connection between the action and the product should feel organic and seamless.
56
  Please create the bullets now.
57
  """
 
105
  num_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)
106
  creativity = st.selectbox("Creatividad", ["Alta", "Media", "Baja"])
107
 
108
+ # Nueva selecci贸n para la llamada a la acci贸n
109
+ action_call = st.selectbox("Tipo de Llamada a la Acci贸n", ["Directo", "Sutil", "Indirecto"])
110
+
111
  # Bot贸n de enviar
112
  submit = st.button("Generar Bullets")
113
 
 
116
  if target_audience:
117
  try:
118
  # Obtener la respuesta del modelo
119
+ generated_bullets = get_gemini_response_bullets(target_audience, num_bullets, creativity, action_call)
120
  col2.markdown(f"""
121
  <div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;">
122
  <h4>Mira la magia:</h4>