Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,53 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
def
|
| 4 |
responses = {
|
| 5 |
-
"
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
}
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
fn=
|
| 17 |
-
inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
|
| 18 |
outputs=gr.Textbox(),
|
| 19 |
title="Cyberpunk 2077 Chatbot",
|
| 20 |
-
description="Interact with V, your guide in Night City!"
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
|
| 4 |
+
def respond(user_input):
|
| 5 |
responses = {
|
| 6 |
+
"night city": [
|
| 7 |
+
"Night City is a vibrant and dangerous place! What do you want to know about it?",
|
| 8 |
+
"Ah, Night City! The city that never sleeps. Any specific place or event you're interested in?",
|
| 9 |
+
"Night City is full of opportunities and risks. What aspect of it intrigues you?"
|
| 10 |
+
],
|
| 11 |
+
"v": [
|
| 12 |
+
"I'm V, your guide through the chaos of Night City. What can I help you with?",
|
| 13 |
+
"V here! Ready to assist you with anything you need in Night City.",
|
| 14 |
+
"You can count on me, V, to show you the ropes in Night City. What do you need?"
|
| 15 |
+
],
|
| 16 |
+
"cyberpunk": [
|
| 17 |
+
"Cyberpunk 2077 is a story about choices and consequences. What are you curious about?",
|
| 18 |
+
"In the world of Cyberpunk, you need to be smart and tough. Any specific topic on Cyberpunk you want to discuss?",
|
| 19 |
+
"Cyberpunk 2077 offers a deep dive into a dystopian future. What's on your mind?"
|
| 20 |
+
],
|
| 21 |
+
"jobs": [
|
| 22 |
+
"Looking for work in Night City? There's always something to do, from gigs to main jobs. Any particular type of job?",
|
| 23 |
+
"Jobs in Night City range from simple gigs to complex heists. What are you interested in?",
|
| 24 |
+
"Night City has no shortage of work, if you're willing to get your hands dirty. What kind of job are you looking for?"
|
| 25 |
+
],
|
| 26 |
+
"gear": [
|
| 27 |
+
"Need to gear up? There are plenty of shops and fixers in Night City. What do you need?",
|
| 28 |
+
"From weapons to cyberware, Night City has it all. Looking for something specific?",
|
| 29 |
+
"Gear is essential for survival in Night City. What type of gear are you interested in?"
|
| 30 |
+
],
|
| 31 |
+
"default": [
|
| 32 |
+
"Night City is full of surprises. What else would you like to know?",
|
| 33 |
+
"There's always something happening in Night City. Any other questions?",
|
| 34 |
+
"I'm here to help you navigate Night City. What else can I assist you with?"
|
| 35 |
+
]
|
| 36 |
}
|
| 37 |
|
| 38 |
+
user_input = user_input.lower()
|
| 39 |
+
for key in responses:
|
| 40 |
+
if key in user_input:
|
| 41 |
+
return random.choice(responses[key])
|
| 42 |
+
return random.choice(responses["default"])
|
| 43 |
|
| 44 |
+
iface = gr.Interface(
|
| 45 |
+
fn=respond,
|
| 46 |
+
inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
|
| 47 |
outputs=gr.Textbox(),
|
| 48 |
title="Cyberpunk 2077 Chatbot",
|
| 49 |
+
description="Interact with V, your guide in Night City!",
|
| 50 |
+
theme="default"
|
| 51 |
)
|
| 52 |
|
| 53 |
+
iface.launch()
|