File size: 1,234 Bytes
3026d7b
 
 
 
 
 
 
 
 
 
8b623e3
3026d7b
 
 
 
 
 
 
 
8b623e3
 
 
 
 
 
 
3026d7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b623e3
be2e823
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()