Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,34 @@ def get_mention_instruction(product_mention, product):
|
|
| 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 = [
|
|
@@ -47,6 +75,9 @@ def get_gemini_response(target_audience, product, formula, length, mood, emotion
|
|
| 47 |
product_mention = get_random_product_mention()
|
| 48 |
mention_instruction = get_mention_instruction(product_mention, product)
|
| 49 |
|
|
|
|
|
|
|
|
|
|
| 50 |
# Obtener t茅cnicas aleatorias
|
| 51 |
copywriting_techniques = get_random_copywriting_technique()
|
| 52 |
techniques_text = " ".join(copywriting_techniques)
|
|
@@ -84,7 +115,7 @@ with col1:
|
|
| 84 |
product = st.text_input("驴Qu茅 producto tienes en mente?")
|
| 85 |
|
| 86 |
with st.expander("Personaliza tu p谩rrafo de apertura"):
|
| 87 |
-
formula = st.selectbox("Selecciona una f贸rmula de copywriting", ["If/Then", "
|
| 88 |
length = st.slider("N煤mero de palabras", min_value=50, max_value=100, value=50)
|
| 89 |
mood = st.selectbox("Tono de voz", ["Conversacional", "Formal", "Persuasivo"])
|
| 90 |
emotionality = st.selectbox("Emocionalidad del texto", ["Triste", "Feliz", "Rom谩ntico", "Sorpresa", "Esperanza", "Ira", "Confianza"])
|
|
|
|
| 30 |
"""
|
| 31 |
return ""
|
| 32 |
|
| 33 |
+
# Funci贸n para obtener la f贸rmula de copywriting seleccionada
|
| 34 |
+
def get_formula_instruction(formula, product):
|
| 35 |
+
if formula == "If/Then":
|
| 36 |
+
return f"""
|
| 37 |
+
Write the opening paragraph using the 'If/Then' structure. Start by presenting a problem or goal the reader might have, and then clearly explain how the product '{product}' can solve it. For example, 'If you want to achieve X, then this product is the solution.'
|
| 38 |
+
"""
|
| 39 |
+
elif formula == "If / Then + Authority":
|
| 40 |
+
return f"""
|
| 41 |
+
Write the opening paragraph using the 'If/Then' structure but add an authority figure or testimonial for added credibility. Start by presenting a problem or goal the reader might have, then explain how the product '{product}' can solve it, while mentioning an authority figure or expert opinion. For example, 'If you want to achieve X, then this expert recommends this product for solving it.'
|
| 42 |
+
"""
|
| 43 |
+
elif formula == "Honesty":
|
| 44 |
+
return f"""
|
| 45 |
+
Write the opening paragraph using an honest approach, focusing on transparency. Introduce the product '{product}' and make it clear that you are not pretending to have all the answers, but you can provide a solution. Be authentic and straightforward.
|
| 46 |
+
"""
|
| 47 |
+
elif formula == "Sensationalist":
|
| 48 |
+
return f"""
|
| 49 |
+
Write the opening paragraph using a sensationalist approach. Introduce an unexpected or shocking fact, and link it to the product '{product}' as the solution. The goal is to create curiosity and urgency in the reader's mind.
|
| 50 |
+
"""
|
| 51 |
+
elif formula == "Ask a Question":
|
| 52 |
+
return f"""
|
| 53 |
+
Write the opening paragraph by asking a provocative question related to the reader's problem or goal. After the question, suggest that the product '{product}' holds the answer.
|
| 54 |
+
"""
|
| 55 |
+
elif formula == "Micro Openings":
|
| 56 |
+
return f"""
|
| 57 |
+
Write the opening paragraph using a very short, impactful sentence. Create a strong hook that grabs the reader's attention immediately. For example, 'What if I told you that you could achieve X with just one simple tool?' Then, introduce the product '{product}' as the key to solving the issue.
|
| 58 |
+
"""
|
| 59 |
+
return ""
|
| 60 |
+
|
| 61 |
# Funci贸n para obtener una t茅cnica de copywriting de manera aleatoria
|
| 62 |
def get_random_copywriting_technique():
|
| 63 |
techniques = [
|
|
|
|
| 75 |
product_mention = get_random_product_mention()
|
| 76 |
mention_instruction = get_mention_instruction(product_mention, product)
|
| 77 |
|
| 78 |
+
# Obtener la instrucci贸n para la f贸rmula seleccionada
|
| 79 |
+
formula_instruction = get_formula_instruction(formula, product)
|
| 80 |
+
|
| 81 |
# Obtener t茅cnicas aleatorias
|
| 82 |
copywriting_techniques = get_random_copywriting_technique()
|
| 83 |
techniques_text = " ".join(copywriting_techniques)
|
|
|
|
| 115 |
product = st.text_input("驴Qu茅 producto tienes en mente?")
|
| 116 |
|
| 117 |
with st.expander("Personaliza tu p谩rrafo de apertura"):
|
| 118 |
+
formula = st.selectbox("Selecciona una f贸rmula de copywriting", ["If/Then", "If / Then + Authority", "Honesty", "Sensationalist", "Ask a Question", "Micro Openings"])
|
| 119 |
length = st.slider("N煤mero de palabras", min_value=50, max_value=100, value=50)
|
| 120 |
mood = st.selectbox("Tono de voz", ["Conversacional", "Formal", "Persuasivo"])
|
| 121 |
emotionality = st.selectbox("Emocionalidad del texto", ["Triste", "Feliz", "Rom谩ntico", "Sorpresa", "Esperanza", "Ira", "Confianza"])
|