Spaces:
Running
Running
Upload 8 files
Browse files- angles.py +88 -0
- app.py +20 -1
- prompts.py +6 -2
angles.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
bullet_angles = {
|
2 |
+
"NINGUNO": {
|
3 |
+
"description": "Generate the bullet without any specific angle",
|
4 |
+
"style": "direct and natural",
|
5 |
+
"keywords": ["clear", "direct", "simple", "natural"]
|
6 |
+
},
|
7 |
+
"CURIOSIDAD": {
|
8 |
+
"description": "Create a bullet that generates intrigue and sparks reader curiosity",
|
9 |
+
"style": "mysterious and provocative",
|
10 |
+
"keywords": ["intriguing", "mysterious", "fascinating", "revealing"]
|
11 |
+
},
|
12 |
+
"CASI IMPOSIBLE": {
|
13 |
+
"description": "Generate a bullet that seems hard to believe but not impossible",
|
14 |
+
"style": "surprising but credible",
|
15 |
+
"keywords": ["incredible", "surprising", "unexpected", "revolutionary"]
|
16 |
+
},
|
17 |
+
"AUTORIDAD": {
|
18 |
+
"description": "Include expert references or credibility-building data",
|
19 |
+
"style": "professional and backed",
|
20 |
+
"keywords": ["expert", "proven", "scientific", "endorsed"]
|
21 |
+
},
|
22 |
+
"CONTRASTE": {
|
23 |
+
"description": "Create a bullet that contrasts opposing ideas",
|
24 |
+
"style": "comparative and revealing",
|
25 |
+
"keywords": ["contrast", "difference", "transformation", "change"]
|
26 |
+
},
|
27 |
+
"DOLOR F脥SICO": {
|
28 |
+
"description": "Focus the bullet on solving physical pain or discomfort",
|
29 |
+
"style": "empathetic and solution-oriented",
|
30 |
+
"keywords": ["relief", "wellness", "comfort", "health"]
|
31 |
+
},
|
32 |
+
"DOLOR PSICOL脫GICO": {
|
33 |
+
"description": "Focus the bullet on solving emotional pain or discomfort",
|
34 |
+
"style": "understanding and healing",
|
35 |
+
"keywords": ["peace", "security", "confidence", "relief"]
|
36 |
+
},
|
37 |
+
"BENEFICIO DIRECTO": {
|
38 |
+
"description": "Present the benefit in a clear and direct way",
|
39 |
+
"style": "direct and specific",
|
40 |
+
"keywords": ["benefit", "result", "achievement", "improvement"]
|
41 |
+
},
|
42 |
+
"ERROR COM脷N": {
|
43 |
+
"description": "Point out a common mistake that the audience should avoid",
|
44 |
+
"style": "educational and preventive",
|
45 |
+
"keywords": ["mistake", "correction", "improvement", "solution"]
|
46 |
+
},
|
47 |
+
"90% SOLUCI脫N": {
|
48 |
+
"description": "Reveal most of the solution while maintaining an element of mystery",
|
49 |
+
"style": "revealing but intriguing",
|
50 |
+
"keywords": ["solution", "secret", "discovery", "method"]
|
51 |
+
},
|
52 |
+
"NINGUNO": {
|
53 |
+
"description": "Natural response without specific tone adjustments",
|
54 |
+
"style": "direct and simple",
|
55 |
+
"keywords": ["clear", "direct", "simple", "natural"],
|
56 |
+
"result": "Standard benefit presentation"
|
57 |
+
},
|
58 |
+
"PROFESIONAL": {
|
59 |
+
"description": "Formal and business-oriented tone",
|
60 |
+
"style": "formal and strategic",
|
61 |
+
"keywords": ["professional", "strategic", "effective", "measurable"],
|
62 |
+
"result": "Business-focused benefit statement"
|
63 |
+
},
|
64 |
+
"HUMOR": {
|
65 |
+
"description": "Fun and light-hearted tone",
|
66 |
+
"style": "casual and entertaining",
|
67 |
+
"keywords": ["funny", "playful", "relaxed", "informal"],
|
68 |
+
"result": "Entertaining benefit with humor"
|
69 |
+
},
|
70 |
+
"SARCASMO": {
|
71 |
+
"description": "Witty and clever tone",
|
72 |
+
"style": "ironic but friendly",
|
73 |
+
"keywords": ["ironic", "witty", "clever", "provocative"],
|
74 |
+
"result": "Clever benefit with subtle irony"
|
75 |
+
},
|
76 |
+
"CREATIVO": {
|
77 |
+
"description": "Imaginative and original tone",
|
78 |
+
"style": "innovative and unique",
|
79 |
+
"keywords": ["creative", "original", "imaginative", "artistic"],
|
80 |
+
"result": "Uniquely crafted benefit statement"
|
81 |
+
},
|
82 |
+
"EMOCIONAL": {
|
83 |
+
"description": "Empathetic and moving tone",
|
84 |
+
"style": "close and personal",
|
85 |
+
"keywords": ["emotional", "sincere", "inspiring", "touching"],
|
86 |
+
"result": "Emotionally resonant benefit"
|
87 |
+
}
|
88 |
+
}
|
app.py
CHANGED
@@ -5,6 +5,7 @@ import google.generativeai as genai
|
|
5 |
from bullet_formulas import bullet_formulas
|
6 |
from style import styles
|
7 |
from prompts import create_instruction
|
|
|
8 |
|
9 |
# Cargar las variables de entorno
|
10 |
load_dotenv()
|
@@ -60,15 +61,33 @@ with col1:
|
|
60 |
number_of_benefits = st.selectbox("N煤mero de Beneficios", options=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], index=4)
|
61 |
|
62 |
# Crear un 煤nico acorde贸n para f贸rmula y creatividad
|
|
|
63 |
with st.expander("Personaliza tus beneficios"):
|
64 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
|
65 |
|
66 |
-
# Update the variable name in the UI section
|
67 |
selected_formula_key = st.selectbox(
|
68 |
"Selecciona una f贸rmula para tus beneficios",
|
69 |
options=list(bullet_formulas.keys())
|
70 |
)
|
71 |
selected_formula = bullet_formulas[selected_formula_key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
# Bot贸n de enviar
|
74 |
submit = st.button("Generar Beneficios")
|
|
|
5 |
from bullet_formulas import bullet_formulas
|
6 |
from style import styles
|
7 |
from prompts import create_instruction
|
8 |
+
from angles import bullet_angles
|
9 |
|
10 |
# Cargar las variables de entorno
|
11 |
load_dotenv()
|
|
|
61 |
number_of_benefits = st.selectbox("N煤mero de Beneficios", options=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], index=4)
|
62 |
|
63 |
# Crear un 煤nico acorde贸n para f贸rmula y creatividad
|
64 |
+
# Inside the expander section:
|
65 |
with st.expander("Personaliza tus beneficios"):
|
66 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
|
67 |
|
|
|
68 |
selected_formula_key = st.selectbox(
|
69 |
"Selecciona una f贸rmula para tus beneficios",
|
70 |
options=list(bullet_formulas.keys())
|
71 |
)
|
72 |
selected_formula = bullet_formulas[selected_formula_key]
|
73 |
+
|
74 |
+
# Add new angle selector
|
75 |
+
with st.expander("脕ngulo del Bullet"):
|
76 |
+
selected_angle_key = st.selectbox(
|
77 |
+
"Selecciona el 谩ngulo para tus beneficios",
|
78 |
+
options=list(bullet_angles.keys())
|
79 |
+
)
|
80 |
+
selected_angle = bullet_angles[selected_angle_key]
|
81 |
+
|
82 |
+
# Update the generate_benefits call
|
83 |
+
generated_benefits = generate_benefits(
|
84 |
+
number_of_benefits,
|
85 |
+
target_audience,
|
86 |
+
product,
|
87 |
+
temperature,
|
88 |
+
selected_formula,
|
89 |
+
selected_angle # Add the angle parameter
|
90 |
+
)
|
91 |
|
92 |
# Bot贸n de enviar
|
93 |
submit = st.button("Generar Beneficios")
|
prompts.py
CHANGED
@@ -51,12 +51,16 @@ IMPORTANTE:
|
|
51 |
f"- {selected_formula['examples'][2]}\n\n"
|
52 |
f"Tu objetivo es inspirar deseo y acci贸n, evitando explicaciones o categor铆as en la respuesta."
|
53 |
)
|
54 |
-
def create_instruction(number_of_benefits, target_audience, product, selected_formula):
|
|
|
|
|
|
|
|
|
55 |
return (
|
56 |
f"{system_prompt}\n\n"
|
57 |
f"Tu tarea es crear {number_of_benefits} beneficios irresistibles dise帽ados para {target_audience}. "
|
58 |
f"El objetivo es mostrar c贸mo {product} puede transformar la vida del lector, conectando de forma natural y emocional. "
|
59 |
-
f"
|
60 |
f"Usa la f贸rmula seleccionada como gu铆a:\n\n{selected_formula['description']}\n\n"
|
61 |
f"Insp铆rate en estos ejemplos:\n"
|
62 |
f"- {selected_formula['examples'][0]}\n"
|
|
|
51 |
f"- {selected_formula['examples'][2]}\n\n"
|
52 |
f"Tu objetivo es inspirar deseo y acci贸n, evitando explicaciones o categor铆as en la respuesta."
|
53 |
)
|
54 |
+
def create_instruction(number_of_benefits, target_audience, product, selected_formula, selected_angle):
|
55 |
+
angle_instruction = ""
|
56 |
+
if selected_angle["description"] != "Generate the bullet without any specific angle":
|
57 |
+
angle_instruction = f"\nApply this angle: {selected_angle['description']}\nStyle: {selected_angle['style']}\nUse these keywords as inspiration: {', '.join(selected_angle['keywords'])}"
|
58 |
+
|
59 |
return (
|
60 |
f"{system_prompt}\n\n"
|
61 |
f"Tu tarea es crear {number_of_benefits} beneficios irresistibles dise帽ados para {target_audience}. "
|
62 |
f"El objetivo es mostrar c贸mo {product} puede transformar la vida del lector, conectando de forma natural y emocional. "
|
63 |
+
f"{angle_instruction}\n"
|
64 |
f"Usa la f贸rmula seleccionada como gu铆a:\n\n{selected_formula['description']}\n\n"
|
65 |
f"Insp铆rate en estos ejemplos:\n"
|
66 |
f"- {selected_formula['examples'][0]}\n"
|