chatbot2 / app.py
meet2akhil's picture
Update app.py
0e1ae0d verified
raw
history blame
2.9 kB
import gradio as gr
import random
def respond(user_input):
responses = {
"how is night city": [
"Night City is a vibrant and dangerous place! What do you want to know about it?",
"Ah, Night City! The city that never sleeps. Any specific place or event you're interested in?",
"Night City is full of opportunities and risks. What aspect of it intrigues you?"
],
"hello v": [
"I'm V, your guide through the chaos of Night City. What can I help you with?",
"V here! Ready to assist you with anything you need in Night City.",
"You can count on me, V, to show you the ropes in Night City. What do you need?"
],
"what is cyberpunk": [
"Cyberpunk 2077 is a story about choices and consequences. What are you curious about?",
"In the world of Cyberpunk, you need to be smart and tough. Any specific topic on Cyberpunk you want to discuss?",
"Cyberpunk 2077 offers a deep dive into a dystopian future. What's on your mind?"
],
"what jobs can i do": [
"Looking for work in Night City? There's always something to do, from gigs to main jobs. Any particular type of job?",
"Jobs in Night City range from simple gigs to complex heists. What are you interested in?",
"Night City has no shortage of work, if you're willing to get your hands dirty. What kind of job are you looking for?"
],
"how to gear up": [
"Need to gear up? There are plenty of shops and fixers in Night City. What do you need?",
"From weapons to cyberware, Night City has it all. Looking for something specific?",
"Gear is essential for survival in Night City. What type of gear are you interested in?"
],
"where is jonny?": [
"Johnny Silverhand is played by the legendary actor Keanu Reeves. His role in the game is funny, gritty, and he fights for justice.",
"You can find Johnny inside a chip called The Relic.",
"Johnny says, 'Hello V, we got a city to burn.'"
],
"default": [
"Night City is full of surprises. What else would you like to know?",
"There's always something happening in Night City. Any other questions?",
"I'm here to help you navigate Night City. What else can I assist you with?"
]
}
user_input = user_input.lower()
for key in responses:
if key in user_input:
return random.choice(responses[key])
return random.choice(responses["default"])
iface = gr.Interface(
fn=respond,
inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
outputs=gr.Textbox(),
title="Cyberpunk 2077 Chatbot",
description="Interact with V, your guide in Night City!",
theme="default"
)
iface.launch()