Maddiew1314 commited on
Commit
0432e96
·
verified ·
1 Parent(s): 8aff873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -55,8 +55,31 @@ def get_top_chunks(query):
55
  def get_nutrition_info(food_query):
56
  url = "https://trackapi.nutritionix.com/v2/natural/nutrients"
57
  headers = {
58
-
 
 
59
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
 
62
  def respond(message, history):
@@ -81,22 +104,8 @@ def respond(message, history):
81
  response+= token
82
  yield response
83
 
84
- custom_pink = gr.themes.Color(
85
- c50="#fff0f5", # very light pink
86
- c100="#ffe4e1",
87
- c200="#ffccd5",
88
- c300="#fbb6ce",
89
- c400="#f687b3",
90
- c500="#ed64a6", # main pink
91
- c600="#d53f8c",
92
- c700="#b83280",
93
- c800="#97266d",
94
- c900="#702459",
95
- c950="#521b41" # darkest shade
96
- )
97
-
98
  theme = gr.themes.Soft(
99
- primary_hue=custom_pink,
100
  secondary_hue="zinc",
101
  neutral_hue="pink",
102
  )
@@ -114,12 +123,3 @@ with gr.Blocks(theme=theme) as demo:
114
  )
115
  #chatbot = gr.ChatInterface(respond, type = 'messages', title= "Hi! I'm Nessie, your personal wellness assistant. What can I assist you with today?",examples=["Can I help you with your dietary goals? I can help you track your calories, macros, and give advice based on personal goals, height, and weight.","Can I help you with your physical health and help you reach your fitness goals? I can give guidance and recommendations for specific workouts based on personal goals.","If you are struggling, I am here. You are so beautiful and so loved! I'm here for whatever you need. "])
116
  demo.launch(debug=True)
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
 
55
  def get_nutrition_info(food_query):
56
  url = "https://trackapi.nutritionix.com/v2/natural/nutrients"
57
  headers = {
58
+ "x-app-id": "5e0843",
59
+ "x-app-key": "00948483e0e3540ea8dc5297ad8216d9",
60
+ "Content-Type": "application/json"
61
  }
62
+ body = {
63
+ "query": food_query
64
+ }
65
+
66
+ response = requests.post(url, headers=headers, json=body)
67
+ if response.status_code == 200:
68
+ data = response.json()
69
+ return data
70
+ else:
71
+ return None
72
+
73
+
74
+ def get_motivational_quote():
75
+ url = "https://zenquotes.io/api/random"
76
+ response = requests.get(url)
77
+ if response.status_code == 200:
78
+ quote = response.json()['q'] + " -" + response.json()[0]['a']
79
+ return quote
80
+ else:
81
+ return "Keep going! You're doing great."
82
+
83
 
84
 
85
  def respond(message, history):
 
104
  response+= token
105
  yield response
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  theme = gr.themes.Soft(
108
+ primary_hue="rose",
109
  secondary_hue="zinc",
110
  neutral_hue="pink",
111
  )
 
123
  )
124
  #chatbot = gr.ChatInterface(respond, type = 'messages', title= "Hi! I'm Nessie, your personal wellness assistant. What can I assist you with today?",examples=["Can I help you with your dietary goals? I can help you track your calories, macros, and give advice based on personal goals, height, and weight.","Can I help you with your physical health and help you reach your fitness goals? I can give guidance and recommendations for specific workouts based on personal goals.","If you are struggling, I am here. You are so beautiful and so loved! I'm here for whatever you need. "])
125
  demo.launch(debug=True)