Spaces:
Running
Running
import os | |
import gradio as gr | |
import google.generativeai as genai | |
from dotenv import load_dotenv | |
from prompts import system_prompt | |
load_dotenv() | |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) | |
model = genai.GenerativeModel( | |
model_name="gemini-2.0-flash", | |
generation_config={ | |
"temperature": 0.9, | |
"top_p": 1, | |
"max_output_tokens": 2048, | |
} | |
) | |
def chat(message, history): | |
return ( | |
f"{system_prompt}\n\n" | |
f"User Message: {message}\n" | |
f"Previous Context: {history if history else 'No previous context'}\n" | |
f"Remember to maintain the friendly and helpful tone of Chucho Bot, " | |
f"focusing only on CopyXpert course information and benefits." | |
) | |
demo = gr.ChatInterface( | |
fn=chat, | |
examples=[ | |
"¿Qué incluye el curso CopyXpert?", | |
"¿Cuál es el precio del curso?", | |
"¿Cómo puedo inscribirme?", | |
"¿Qué beneficios obtendré?", | |
"¿Cuál es la metodología del curso?", | |
"¿Necesito experiencia previa?" | |
], | |
title="🤖Chucho Bot - CopyXpert Sales Assistant", | |
description="¡Hola! Soy Chucho Bot, tu asistente personal para el curso CopyXpert. ¿Cómo puedo ayudarte hoy?" | |
) | |
demo.launch() | |