Spaces:
Sleeping
Sleeping
Pratik Dwivedi
commited on
Commit
·
1d64b5f
1
Parent(s):
7a4dd15
main key
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ def ask_gpt3_personalized(prompt, height_cm, weight_kg, age):
|
|
6 |
response = openai.ChatCompletion.create(
|
7 |
model="gpt-3.5-turbo",
|
8 |
messages=[
|
9 |
-
{"role": "system", "content": "You are a chatbot that will answer queries related to fitness and nutrition. The chatbot should understand questions about workout routines, dietary advice, and general fitness tips. Chatbot will offer personalized workout and diet plans based on user inputs such as body type, fitness goals, and dietary restrictions.
|
10 |
{"role": "user", "content": "my height is " + str(height_cm) + " cm, my weight is " + str(weight_kg) + " kg, and I am " + str(age) + " years old."+prompt},
|
11 |
]
|
12 |
)
|
@@ -16,7 +16,7 @@ def ask_gpt3(prompt):
|
|
16 |
response = openai.ChatCompletion.create(
|
17 |
model="gpt-3.5-turbo",
|
18 |
messages=[
|
19 |
-
{"role": "system", "content": "You are a chatbot that will answer queries related to fitness and nutrition. The chatbot should understand questions about workout routines, dietary advice, and general fitness tips. Chatbot will offer personalized workout and diet plans based on user inputs such as body type, fitness goals, and dietary restrictions.
|
20 |
{"role": "user", "content": prompt},
|
21 |
]
|
22 |
)
|
@@ -28,7 +28,9 @@ def main():
|
|
28 |
|
29 |
# add a sibebar that can take in user input for the chatbot prompt and the API key
|
30 |
st.sidebar.title("Personal Information")
|
31 |
-
|
|
|
|
|
32 |
height_cm = st.sidebar.number_input("Height (cm)", 0, 300)
|
33 |
weight_kg = st.sidebar.number_input("Weight (kg)", 0, 300)
|
34 |
age = st.sidebar.number_input("Age", 0, 100)
|
|
|
6 |
response = openai.ChatCompletion.create(
|
7 |
model="gpt-3.5-turbo",
|
8 |
messages=[
|
9 |
+
{"role": "system", "content": "You are a chatbot that will answer queries related to fitness and nutrition. The chatbot should understand questions about workout routines, dietary advice, and general fitness tips. Chatbot will offer personalized workout and diet plans based on user inputs such as body type, fitness goals, and dietary restrictions.{messages}"},
|
10 |
{"role": "user", "content": "my height is " + str(height_cm) + " cm, my weight is " + str(weight_kg) + " kg, and I am " + str(age) + " years old."+prompt},
|
11 |
]
|
12 |
)
|
|
|
16 |
response = openai.ChatCompletion.create(
|
17 |
model="gpt-3.5-turbo",
|
18 |
messages=[
|
19 |
+
{"role": "system", "content": "You are a chatbot that will answer queries related to fitness and nutrition. The chatbot should understand questions about workout routines, dietary advice, and general fitness tips. Chatbot will offer personalized workout and diet plans based on user inputs such as body type, fitness goals, and dietary restrictions.{messages}"},
|
20 |
{"role": "user", "content": prompt},
|
21 |
]
|
22 |
)
|
|
|
28 |
|
29 |
# add a sibebar that can take in user input for the chatbot prompt and the API key
|
30 |
st.sidebar.title("Personal Information")
|
31 |
+
# this is a sceret key that should not be shared with anyone
|
32 |
+
# openai.api_key = st.sidebar.text_input("Your OpenAI API Key here", "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")
|
33 |
+
openai.api_key = st.sidebar.text_input("OpenAI API Key", type="password", value = "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")
|
34 |
height_cm = st.sidebar.number_input("Height (cm)", 0, 300)
|
35 |
weight_kg = st.sidebar.number_input("Weight (kg)", 0, 300)
|
36 |
age = st.sidebar.number_input("Age", 0, 100)
|