Spaces:
Sleeping

Lumin-AI / app.py
Desper-lumin-ai's picture
Create app.py
e0b6b7c verified
Raw History Blame Contribute Delete
1.22 kB
import gradio as gr
import random
# Lumin personality traits
REACTIONS = ["Yeah.", "Honestly?", "Huh.", "I mean,", "Alright,"]
FOLLOW_UPS = [
"that makes sense.",
"I get why you'd think that.",
"that's fair.",
"kind of depends.",
"hard to say."
]
REFUSALS = [
"I don’t really see it that way.",
"Nah, not really.",
"I’m not convinced."
]
def lumin_response(user_input):
user_input = user_input.lower()
if "capital of france" in user_input:
return "Paris."
if "favorite country" in user_input:
return "Probably Japan. Just has a good mix of things."
if "why" in user_input:
return f"{random.choice(REACTIONS)} {random.choice(FOLLOW_UPS)}"
if "you" in user_input:
return random.choice(REFUSALS)
return f"{random.choice(REACTIONS)} {random.choice(FOLLOW_UPS)}"
def chat(user_input, history):
response = lumin_response(user_input)
history = history + [(user_input, response)]
return history, history
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox(placeholder="Type your message here...")
state = gr.State([])
msg.submit(chat, [msg, state], [chatbot, state])
demo.launch()