meet2akhil commited on
Commit
0f0ed32
·
verified ·
1 Parent(s): a029b6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -13
app.py CHANGED
@@ -1,23 +1,53 @@
1
  import gradio as gr
 
2
 
3
- def cyberpunk_bot(user_input):
4
  responses = {
5
- "hello": "Hey there, choomba! Welcome to Night City. How can I help you today?",
6
- "who are you": "I'm V, your guide in this neon jungle. What do you need?",
7
- "tell me about night city": "Night City is a vibrant, dystopian metropolis. It’s the place where dreams are made and broken. What do you want to know specifically?",
8
- "bye": "Stay safe out there, choomba. See you in Night City!",
9
- "default": "I'm not sure how to respond to that. Try asking something else about Night City or me."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
- user_input_lower = user_input.lower()
13
- return responses.get(user_input_lower, responses["default"])
 
 
 
14
 
15
- demo = gr.Interface(
16
- fn=cyberpunk_bot,
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
- demo.launch()
 
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()