geethareddy commited on
Commit
804e30e
·
verified ·
1 Parent(s): 0963c3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -18
app.py CHANGED
@@ -17,20 +17,23 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
17
  # Init TTS
18
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
19
 
20
- # Menu Data (You can modify this as per your actual menu)
21
  def load_menu():
22
  menu = {
23
- "Breads": [
24
- {"name": "Roti", "price": 1.50, "description": "Indian flatbread"},
25
- {"name": "Naan", "price": 2.00, "description": "Soft leavened flatbread"}
 
26
  ],
27
- "Curries": [
28
- {"name": "Butter Chicken", "price": 7.99, "description": "Creamy and rich chicken curry"},
29
- {"name": "Paneer Tikka Masala", "price": 6.99, "description": "Cottage cheese in a spiced gravy"}
 
30
  ],
31
- "Biryanis": [
32
- {"name": "Chicken Biryani", "price": 8.99, "description": "Fragrant rice with spiced chicken"},
33
- {"name": "Vegetable Biryani", "price": 7.50, "description": "Fragrant rice with mixed vegetables"}
 
34
  ]
35
  }
36
  return menu
@@ -38,18 +41,18 @@ def load_menu():
38
  # Function to process commands and get menu details
39
  def process_command(command):
40
  menu = load_menu()
41
-
42
  if 'menu' in command.lower():
43
  return "Here's our menu: \n" + "\n".join([f"{category}: {', '.join([item['name'] for item in items])}" for category, items in menu.items()])
44
 
45
- elif 'breads' in command.lower():
46
- return "Our breads: " + ", ".join([item['name'] for item in menu["Breads"]])
47
 
48
- elif 'curries' in command.lower():
49
- return "Our curries: " + ", ".join([item['name'] for item in menu["Curries"]])
50
 
51
- elif 'biryani' in command.lower():
52
- return "Our biryanis: " + ", ".join([item['name'] for item in menu["Biryanis"]])
53
 
54
  return "I'm sorry, I didn't understand that command."
55
 
@@ -90,7 +93,7 @@ def interact_with_assistant(user_input, speaker_audio, language):
90
  iface = gr.Interface(fn=interact_with_assistant,
91
  inputs=[gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
92
  gr.Audio(type="filepath", label="Upload audio file"),
93
- gr.Radio([ 'english'], label="language"),
94
  ],
95
  outputs=gr.Audio(type="filepath", label="Generated audio file"),
96
  title="Voice Assistant - Menu and Voice Cloning")
 
17
  # Init TTS
18
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
19
 
20
+ # Updated Menu Data (Including Drinks, Vegetarian, Non-Vegetarian)
21
  def load_menu():
22
  menu = {
23
+ "Drinks": [
24
+ {"name": "Coca-Cola", "price": 1.50, "description": "Refreshing carbonated soft drink"},
25
+ {"name": "Lemonade", "price": 1.20, "description": "Freshly made lemon drink with a sweet twist"},
26
+ {"name": "Mango Lassi", "price": 2.00, "description": "Smooth yogurt drink with mango flavor"}
27
  ],
28
+ "Vegetarian": [
29
+ {"name": "Paneer Butter Masala", "price": 6.99, "description": "Cottage cheese in a creamy, spiced gravy"},
30
+ {"name": "Chole Bhature", "price": 5.50, "description": "Spicy chickpeas served with deep-fried bread"},
31
+ {"name": "Aloo Gobi", "price": 5.00, "description": "Potatoes and cauliflower cooked with spices"}
32
  ],
33
+ "Non-Vegetarian": [
34
+ {"name": "Butter Chicken", "price": 7.99, "description": "Grilled chicken cooked in a rich, creamy sauce"},
35
+ {"name": "Chicken Tikka", "price": 6.50, "description": "Marinated chicken chunks grilled to perfection"},
36
+ {"name": "Lamb Rogan Josh", "price": 8.99, "description": "Tender lamb cooked in aromatic spices and gravy"}
37
  ]
38
  }
39
  return menu
 
41
  # Function to process commands and get menu details
42
  def process_command(command):
43
  menu = load_menu()
44
+
45
  if 'menu' in command.lower():
46
  return "Here's our menu: \n" + "\n".join([f"{category}: {', '.join([item['name'] for item in items])}" for category, items in menu.items()])
47
 
48
+ elif 'drinks' in command.lower():
49
+ return "Our drinks: " + ", ".join([item['name'] for item in menu["Drinks"]])
50
 
51
+ elif 'vegetarian' in command.lower():
52
+ return "Our vegetarian dishes: " + ", ".join([item['name'] for item in menu["Vegetarian"]])
53
 
54
+ elif 'non-vegetarian' in command.lower():
55
+ return "Our non-vegetarian dishes: " + ", ".join([item['name'] for item in menu["Non-Vegetarian"]])
56
 
57
  return "I'm sorry, I didn't understand that command."
58
 
 
93
  iface = gr.Interface(fn=interact_with_assistant,
94
  inputs=[gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
95
  gr.Audio(type="filepath", label="Upload audio file"),
96
+ gr.Radio(['ru', 'en', 'zh-cn', 'ja', 'de', 'fr', 'it', 'pt', 'pl', 'tr', 'ko', 'nl', 'cs', 'ar', 'es', 'hu'], label="Language"),
97
  ],
98
  outputs=gr.Audio(type="filepath", label="Generated audio file"),
99
  title="Voice Assistant - Menu and Voice Cloning")