Spaces:
Sleeping
Sleeping
Update app.py
Browse files18 unmodified lines19202122232425262728293 unmodified lines333435363738394041424344454647484950517 unmodified lines5960616263646566676847 unmodified lines1161171181191201212 unmodified lines12412512612712812913018 unmodified lines# Crear la instrucci贸n para la llamada a la acci贸n seg煤n la opci贸n seleccionadadef get_call_to_action_instruction(action_call):if action_call == "Directo":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."elif action_call == "Sutil":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."elif action_call == "Indirecto":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."return ""# System Prompt - Instrucci贸n en ingl茅s para el modelo3 unmodified lines"""# Funci贸n para obtener una cantidad de bulletsdef get_gemini_response_bullets(target_audience, num_bullets, creativity):action_call = get_random_call_to_action() # Obtener la llamada a la acci贸n aleatoriacall_to_action_instruction = get_call_to_action_instruction(action_call) # Definir la instrucci贸n aqu铆model_choice = "gemini-1.5-flash" # Modelo por defectomodel = genai.GenerativeModel(model_choice)# System Prompt - Instrucci贸n en ingl茅s para el modelosystem_instruction = """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.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.'."""# Crear el prompt para generar bulletsfull_prompt = f"""{system_instruction}7 unmodified lines* Asking a Question: 'Did you know that...'* 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.'Use the following mention instructions to guide your writing: {call_to_action_instruction}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:- Direct: Clearly highlight the action the reader should take as the solution.- Subtle: Suggest the action without naming it directly.- Indirect: Present the action in a way that feels natural and inevitable without stating it explicitly.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.Please create the bullets now."""47 unmodified linesnum_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)creativity = st.selectbox("Creatividad", ["Alta", "Media", "Baja"])# Bot贸n de enviarsubmit = st.button("Generar Bullets")2 unmodified linesif target_audience:try:# Obtener la respuesta del modelogenerated_bullets = get_gemini_response_bullets(target_audience, num_bullets, creativity) # Sin menci贸n del productocol2.markdown(f"""<div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;"><h4>Mira la magia:</h4>18 unmodified lines19202122232425262728293 unmodified lines3334353637383940414243447 unmodified lines52535455565747 unmodified lines1051061071081091101111121132 unmodified lines11611711811912012112218 unmodified lines# Crear la instrucci贸n para la llamada a la acci贸n seg煤n la opci贸n seleccionadadef get_call_to_action_instruction(action_call):if action_call == "Directo":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."elif action_call == "Sutil":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."elif action_call == "Indirecto":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."return ""# System Prompt - Instrucci贸n en ingl茅s para el modelo3 unmodified lines"""# Funci贸n para obtener una cantidad de bulletsdef get_gemini_response_bullets(target_audience, num_bullets, creativity, action_call):call_to_action_instruction = get_call_to_action_instruction(action_call) # Definir la instrucci贸n aqu铆model_choice = "gemini-1.5-flash" # Modelo por defectomodel = genai.GenerativeModel(model_choice)# Crear el prompt para generar bulletsfull_prompt = f"""{system_instruction}7 unmodified lines* Asking a Question: 'Did you know that...'* 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.'Use the following mention instructions to guide your writing: {call_to_action_instruction}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.Please create the bullets now."""47 unmodified linesnum_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)creativity = st.selectbox("Creatividad", ["Alta", "Media", "Baja"])# Nueva selecci贸n para la llamada a la acci贸naction_call = st.selectbox("Tipo de Llamada a la Acci贸n", ["Directo", "Sutil", "Indirecto"])# Bot贸n de enviarsubmit = st.button("Generar Bullets")2 unmodified linesif target_audience:try:# Obtener la respuesta del modelogenerated_bullets = get_gemini_response_bullets(target_audience, num_bullets, creativity, action_call)col2.markdown(f"""<div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;"><h4>Mira la magia:</h4>
app.py+8-16