JeCabrera commited on
Commit
afdeed9
verified
1 Parent(s): dc6da68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -11,9 +11,25 @@ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
11
  # Funci贸n para obtener una menci贸n del producto de manera probabil铆stica
12
  def get_random_product_mention():
13
  mentions = ["Directa", "Indirecta", "Metaf贸rica"]
14
- probabilities = [0.34, 0.33, 0.33] # Probabilidades de cada menci贸n
15
  return random.choices(mentions, probabilities)[0]
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  # Funci贸n para obtener una t茅cnica de copywriting de manera aleatoria
18
  def get_random_copywriting_technique():
19
  techniques = [
@@ -58,7 +74,7 @@ def get_gemini_response(target_audience, product, text_type, length, mood, emoti
58
 
59
  # Crear el prompt completo basado en los campos del frontend
60
  full_prompt = f"""
61
- You are a creative writer skilled in the art of persuasion. The tone of the {text_type} should be {mood} and {emotionality} emotionally resonate with a {target_audience}. Evoke feelings of {target_audience} through relatable, real-life situations that reflect their experiences. {product_mention} {format_instruction}
62
  Use the following copywriting techniques to write this opening paragraph: {techniques_text}.
63
  Use persuasive techniques to guide the reader towards an intuitive understanding of the product's benefits, focusing on creating a strong emotional connection with the audience.
64
  Create an opening paragraph for a {text_type} of {length} words in Spanish that makes {target_audience} aware they have a problem. Highlight this problem by explaining it with relatable situations tailored to their context, using a natural or conversational tone. The goal of this paragraph is to entice them to keep reading and discover what {product} is about. Use persuasion effectively in every word, mastering advanced techniques.
 
11
  # Funci贸n para obtener una menci贸n del producto de manera probabil铆stica
12
  def get_random_product_mention():
13
  mentions = ["Directa", "Indirecta", "Metaf贸rica"]
14
+ probabilities = [0.34, 0.33, 0.33]
15
  return random.choices(mentions, probabilities)[0]
16
 
17
+ # Crear la instrucci贸n de menci贸n basada en la opci贸n seleccionada
18
+ def get_mention_instruction(product_mention, product):
19
+ if product_mention == "Directa":
20
+ return f"""
21
+ Directly introduce the product '{product}' as the clear solution to the problem the reader is facing. Ensure that the product is presented in a way that highlights its key benefits and demonstrates how it directly addresses the issue at hand. The mention should feel natural and seamlessly integrated into the narrative.
22
+ """
23
+ elif product_mention == "Indirecta":
24
+ return f"""
25
+ Subtly reference the product '{product}' as a potential solution to the reader's problem without naming it explicitly. Weave the product's core benefits into the description of how the reader can overcome the issue, creating an implicit connection between the solution and the product. Ensure the mention is subtle but clear enough to guide the reader towards the product.
26
+ """
27
+ elif product_mention == "Metaf贸rica":
28
+ return f"""
29
+ Introduce the product '{product}' using a metaphor, connecting it symbolically to the solution the reader needs. The metaphor should relate to the problem being discussed and should creatively suggest how the product offers a resolution without explicitly stating its name. The metaphor should evoke the benefits of the product in a memorable and thought-provoking way.
30
+ """
31
+ return ""
32
+
33
  # Funci贸n para obtener una t茅cnica de copywriting de manera aleatoria
34
  def get_random_copywriting_technique():
35
  techniques = [
 
74
 
75
  # Crear el prompt completo basado en los campos del frontend
76
  full_prompt = f"""
77
+ You are a creative writer skilled in the art of persuasion. The tone of the {text_type} should be {mood} and {emotionality} emotionally resonate with a {target_audience}. Evoke feelings of {target_audience} through relatable, real-life situations that reflect their experiences. {mention_instruction} {format_instruction}
78
  Use the following copywriting techniques to write this opening paragraph: {techniques_text}.
79
  Use persuasive techniques to guide the reader towards an intuitive understanding of the product's benefits, focusing on creating a strong emotional connection with the audience.
80
  Create an opening paragraph for a {text_type} of {length} words in Spanish that makes {target_audience} aware they have a problem. Highlight this problem by explaining it with relatable situations tailored to their context, using a natural or conversational tone. The goal of this paragraph is to entice them to keep reading and discover what {product} is about. Use persuasion effectively in every word, mastering advanced techniques.