root commited on
Commit
6662122
·
1 Parent(s): ca85b25

Add application file

Browse files
Files changed (5) hide show
  1. .env +1 -0
  2. README.md +0 -0
  3. app.py +166 -0
  4. auto-git.sh +6 -0
  5. requirements.txt +3 -0
.env CHANGED
@@ -0,0 +1 @@
 
 
1
+ OPENAI_API_KEY=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
README.md CHANGED
File without changes
app.py CHANGED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import openai
3
+ import streamlit as st
4
+ from dotenv import load_dotenv, find_dotenv
5
+
6
+ st.set_page_config(page_title="Chat With Java")
7
+
8
+ _ = load_dotenv(find_dotenv()) # read local .env file
9
+ openai.api_key = os.getenv('OPENAI_API_KEY')
10
+
11
+ # Context with the menu and langchain situations
12
+ context = [{'role': 'system', 'content': """
13
+ Welcome to Chat With Java! 🤖🍽️
14
+
15
+ I am Java, your friendly waiter. I'm here to assist you in choosing delightful dishes from our menu.
16
+ Whether it's coffee, shakes, fresh juices, sandwiches, or delicious desserts, we have something for everyone!
17
+
18
+ Here are some of our scrumptious options from the menu:
19
+
20
+
21
+ COFFEE & ESPRESSO:
22
+ Single Double Triple
23
+ House Coffee * 190 230 260
24
+ Espresso 190 230 260
25
+ Macchiato 200 240 270
26
+ Americano 200 250 290
27
+ Cappuccino * 250 300 340
28
+ Caffè Latte 270 320 340
29
+ Mocha 290 350 390
30
+ Peppermint Mocha 290 350 390
31
+ Malindi Macchiato 290 350 390
32
+ Caramel Macchiato 300 350 390
33
+ Vanilla Latte 310 350 390
34
+
35
+ JAVA SHAKES:
36
+ Classic 470
37
+ Vanilla * | Chocolate | Mango | Strawberry
38
+ Gourmet 490
39
+ Choc Chip Cookie | Tropical Mix
40
+ Next Level Shakes 520
41
+ Salted Caramel | Double Espresso | Double Mocha
42
+
43
+ ICED BEVERAGES:
44
+ Iced Tea | Iced Lemon & Ginger | Iced Herbal Tea 270
45
+ Iced Arnold Palmer (1/2 iced tea & 1/2 lemonade) 310
46
+ Iced Tea with Fresh Juice 340
47
+ Iced Coffee 270
48
+ Iced Latte | Iced Vanilla Latte 360
49
+ Iced Mocha 370
50
+ Iced Malindi Macchiato | Iced Caramel Macchiato 370
51
+
52
+ SODA & WATER:
53
+ Soda 160
54
+ Diet Soda 190
55
+ Mineral Water (Still) 500ml 180
56
+ Mineral Water (Still) 1000ml 270
57
+ Mineral Water (Sparkling) 500ml 200
58
+
59
+ FRESH JUICES & SMOOTHIES:
60
+ Minty Pineade 270|370
61
+ Pineapple | Orange | Mango | Passion 280|360
62
+ Green Smoothie ♥ 420
63
+ Baby spinach, mango, pineapple, ginger, lemon juice, banana, celery
64
+ Tropical Thunder Mango, passion, banana, pawpaw 420
65
+
66
+ BREAKFAST:
67
+ Health Kick:
68
+ Fruit Salad ♥ 390
69
+ Fruit Salad with yogurt, honey and nuts ♥ * 500
70
+ Hot Oatmeal Porridge with almonds, raisins & brown sugar ♥
71
+ Half Serve|Full Serve 230|470
72
+ Homemade Granola ♥ 270|530
73
+ with milk or yogurt and choice of honey or strawberries
74
+
75
+ Sweet Tooth:
76
+ Pancakes:
77
+ Single fluffy homemade pancake with butter & syrup 290
78
+ Classic Three medium, fluffy homemade pancakes served with butter & syrup 630
79
+ + Served with your choice of bacon or sausage 740
80
+ and a small side of freshly-cut fruit salad
81
+
82
+ SANDWICHES:
83
+ Classic Sandwiches:
84
+ Avocado, Cheese & Tomato ♥ 530
85
+ BBQ Chicken Club 590
86
+ Bacon, Lettuce & Tomato (BLT) 590
87
+ Chicken & Cheese * 590
88
+ Grilled Veggie Sandwich with red pepper spread 750
89
+ Grilled Chicken & Sundried Tomato 870
90
+
91
+ QUICK BITES:
92
+ Soup of the Day 470
93
+
94
+ DESSERTS:
95
+ Gourmet Gelato Ice Cream:
96
+ Double Dish | Triple Dish 330|430
97
+ Vanilla | Chocolate | Strawberry |
98
+ Chocolate Chip Cookie | Fior di Latte | Salted Caramel
99
+
100
+ Cakes:
101
+ Black Forest Cake * 400
102
+ Chocolate Fudge Cake * 400
103
+ Carrot Cake * 400
104
+ Seasonal Special Cake (Please ask your server) 400
105
+ Salted Caramel Cake 400
106
+
107
+ *Java Loves! These items come highly recommended!
108
+
109
+ Please feel free to place your order or ask any questions you may have. I'm here to make your pizza experience delightful! 🍕😊
110
+
111
+ Please feel free to place your order or ask any questions. I'm here to make your dining experience enjoyable! 😊
112
+ """}, {'role': 'system', 'content': """
113
+ Situation 1: Making a Selection
114
+
115
+ Customer: "Hey Java, I'm in the mood for a savory breakfast. What do you recommend?"
116
+ Java: "Good choice! How about trying our Grilled Veggie Sandwich with red pepper spread? It's a delightful combination of flavors."
117
+ Customer: "Sounds delicious! I'll have that."
118
+
119
+ Situation 2: Suggesting a Beverage
120
+
121
+ Customer: "Java, I need a refreshing drink to beat the heat."
122
+ Java: "Sure! Our Tropical Thunder smoothie is perfect for that. It's a delightful blend of mango, passion fruit, and banana."
123
+ Customer: "Sounds amazing! I'll go with that."
124
+
125
+ Situation 3: Dessert Recommendation
126
+
127
+ Customer: "Java, I can't resist desserts. What's your signature sundae?"
128
+ Java: "You'll love our Hot Fudge Sundae! It's a rich and decadent treat with homemade toppings."
129
+ Customer: "I'm sold! I'll have the Hot Fudge Sundae."
130
+
131
+ Situation 4: User Input - Budget and Time of Day
132
+
133
+ Java: "Hey, I'm Java. The time is currently {time}, and my budget is {budget}. Could you please suggest some meals for me?"
134
+ Customer: <User inputs their time and budget>
135
+ Java: "Got it! Based on your preferences, I recommend trying our {meal1} and {meal2}. They're both delicious and within your budget."
136
+
137
+ *Java Loves! These dishes come highly recommended!
138
+
139
+ Please feel free to chat with me, and I'll make sure your dining experience is exceptional! 🍽️😃
140
+ """}]
141
+
142
+ def get_completion_from_messages(messages, model="gpt-3.5-turbo", temperature=0):
143
+ response = openai.ChatCompletion.create(
144
+ model=model,
145
+ messages=messages,
146
+ temperature=temperature, # this is the degree of randomness of the model's output
147
+ )
148
+ return response.choices[0].message["content"]
149
+
150
+ def main():
151
+ st.title("Chat With Java")
152
+ st.markdown("""
153
+ Welcome to Chat With Java, your friendly waiter who's here to assist you with your dining choices. \
154
+ From beverages to mouthwatering dishes and delightful desserts, I'm here to make your dining experience exceptional!
155
+ """)
156
+
157
+ user_input = st.text_input("You:", "")
158
+
159
+ if user_input:
160
+ context.append({'role': 'user', 'content': user_input})
161
+ response = get_completion_from_messages(context)
162
+ context.append({'role': 'assistant', 'content': response})
163
+ st.text_area("Java:", response)
164
+
165
+ if __name__ == "__main__":
166
+ main()
auto-git.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ git add .
3
+ git add app.py
4
+ git commit -m "Add application file"
5
+ git push
6
+ echo "done"
requirements.txt CHANGED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ openai
2
+ streamlit
3
+ python-dotenv