Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -35,14 +35,14 @@ def get_mention_instruction(product_mention, product): | |
| 35 | 
             
            # Funci贸n para obtener una cantidad de bullets
         | 
| 36 | 
             
            def get_gemini_response_bullets(target_audience, product, num_bullets, temperature):
         | 
| 37 | 
             
                product_mention = get_random_product_mention()
         | 
| 38 | 
            -
                mention_instruction = get_mention_instruction(product_mention, product) | 
| 39 | 
             
                model_choice = "gemini-1.5-flash"  # Modelo por defecto
         | 
| 40 |  | 
| 41 | 
             
                # Configuraci贸n del modelo generativo y las instrucciones del sistema
         | 
| 42 | 
             
                model = genai.GenerativeModel(
         | 
| 43 | 
            -
                    model_name=model_choice,   | 
| 44 | 
             
                    generation_config={
         | 
| 45 | 
            -
                        "temperature": temperature,   | 
| 46 | 
             
                        "top_p": 0.85,       
         | 
| 47 | 
             
                        "top_k": 128,        
         | 
| 48 | 
             
                        "max_output_tokens": 2048,
         | 
| @@ -72,16 +72,16 @@ def get_gemini_response_bullets(target_audience, product, num_bullets, temperatu | |
| 72 | 
             
                        f"Al responder, siempre incluye un encabezado que haga referencia a {target_audience} y el producto de la siguiente manera: "
         | 
| 73 | 
             
                        f"'Aqu铆 tienes 5 bullets para {target_audience}, que aumenten el deseo de adquirir el {product}, usando la menci贸n indirecta:' "
         | 
| 74 | 
             
                    )
         | 
|  | |
| 75 |  | 
| 76 | 
             
                # Crear el prompt para generar bullets
         | 
| 77 | 
            -
             | 
| 78 | 
             
                chat_session = model.start_chat(
         | 
| 79 | 
             
                    history=[
         | 
| 80 | 
             
                        {
         | 
| 81 | 
             
                            "role": "user",
         | 
| 82 | 
             
                            "parts": [
         | 
| 83 | 
             
                                f"Tu tarea es escribir {num_bullets} bullets que denoten los beneficios del {product} y que tienen la cualidad de fascinar y por lo tanto, fomentan el deseo de adquirir, asistir, descargar o comprar el {product}."
         | 
| 84 | 
            -
                                f"Un buen bullet conecta los s铆ntomas con los problemas  | 
| 85 | 
             
                                f"Escribe bullets creativos, en un estilo conversacional, que no sean aburridos, sino mas bien divertidos. "
         | 
| 86 | 
             
                                f"Utiliza la funci贸n {mention_instruction} al crear los bullets para referirte a los beneficios del {product}. "
         | 
| 87 | 
             
                                "Por favor, crea los bullets ahora."
         | 
| @@ -89,9 +89,9 @@ def get_gemini_response_bullets(target_audience, product, num_bullets, temperatu | |
| 89 | 
             
                        },
         | 
| 90 | 
             
                    ]
         | 
| 91 | 
             
                )
         | 
| 92 | 
            -
             | 
| 93 | 
             
                # Crear un mensaje para el modelo que incluye los bullets generados seg煤n los tipos seleccionados
         | 
| 94 | 
            -
                full_prompt = f"{ | 
| 95 |  | 
| 96 | 
             
                response = model.generate_content([full_prompt])
         | 
| 97 |  | 
| @@ -158,6 +158,6 @@ if submit: | |
| 158 | 
             
                            </div>
         | 
| 159 | 
             
                        """, unsafe_allow_html=True)
         | 
| 160 | 
             
                    except ValueError as e:
         | 
| 161 | 
            -
                         | 
| 162 | 
             
                else:
         | 
| 163 | 
            -
                     | 
|  | |
| 35 | 
             
            # Funci贸n para obtener una cantidad de bullets
         | 
| 36 | 
             
            def get_gemini_response_bullets(target_audience, product, num_bullets, temperature):
         | 
| 37 | 
             
                product_mention = get_random_product_mention()
         | 
| 38 | 
            +
                mention_instruction = get_mention_instruction(product_mention, product)
         | 
| 39 | 
             
                model_choice = "gemini-1.5-flash"  # Modelo por defecto
         | 
| 40 |  | 
| 41 | 
             
                # Configuraci贸n del modelo generativo y las instrucciones del sistema
         | 
| 42 | 
             
                model = genai.GenerativeModel(
         | 
| 43 | 
            +
                    model_name=model_choice,  
         | 
| 44 | 
             
                    generation_config={
         | 
| 45 | 
            +
                        "temperature": temperature,  
         | 
| 46 | 
             
                        "top_p": 0.85,       
         | 
| 47 | 
             
                        "top_k": 128,        
         | 
| 48 | 
             
                        "max_output_tokens": 2048,
         | 
|  | |
| 72 | 
             
                        f"Al responder, siempre incluye un encabezado que haga referencia a {target_audience} y el producto de la siguiente manera: "
         | 
| 73 | 
             
                        f"'Aqu铆 tienes 5 bullets para {target_audience}, que aumenten el deseo de adquirir el {product}, usando la menci贸n indirecta:' "
         | 
| 74 | 
             
                    )
         | 
| 75 | 
            +
                )
         | 
| 76 |  | 
| 77 | 
             
                # Crear el prompt para generar bullets
         | 
|  | |
| 78 | 
             
                chat_session = model.start_chat(
         | 
| 79 | 
             
                    history=[
         | 
| 80 | 
             
                        {
         | 
| 81 | 
             
                            "role": "user",
         | 
| 82 | 
             
                            "parts": [
         | 
| 83 | 
             
                                f"Tu tarea es escribir {num_bullets} bullets que denoten los beneficios del {product} y que tienen la cualidad de fascinar y por lo tanto, fomentan el deseo de adquirir, asistir, descargar o comprar el {product}."
         | 
| 84 | 
            +
                                f"Un buen bullet conecta los s铆ntomas con los problemas enfrentados por {target_audience} de una manera natural, que no se note como manipuladora."
         | 
| 85 | 
             
                                f"Escribe bullets creativos, en un estilo conversacional, que no sean aburridos, sino mas bien divertidos. "
         | 
| 86 | 
             
                                f"Utiliza la funci贸n {mention_instruction} al crear los bullets para referirte a los beneficios del {product}. "
         | 
| 87 | 
             
                                "Por favor, crea los bullets ahora."
         | 
|  | |
| 89 | 
             
                        },
         | 
| 90 | 
             
                    ]
         | 
| 91 | 
             
                )
         | 
| 92 | 
            +
             | 
| 93 | 
             
                # Crear un mensaje para el modelo que incluye los bullets generados seg煤n los tipos seleccionados
         | 
| 94 | 
            +
                full_prompt = f"{mention_instruction}"
         | 
| 95 |  | 
| 96 | 
             
                response = model.generate_content([full_prompt])
         | 
| 97 |  | 
|  | |
| 158 | 
             
                            </div>
         | 
| 159 | 
             
                        """, unsafe_allow_html=True)
         | 
| 160 | 
             
                    except ValueError as e:
         | 
| 161 | 
            +
                        st.error(e)
         | 
| 162 | 
             
                else:
         | 
| 163 | 
            +
                    st.error("Por favor, completa todos los campos.")
         | 
