-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver1.py
More file actions
117 lines (100 loc) · 3.67 KB
/
Copy pathserver1.py
File metadata and controls
117 lines (100 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from flask import Flask, request, jsonify, json
app = Flask(__name__)
@app.route('/post_data', methods=['POST'])
def get_data():
data = request.json
name_val = data['name']
age_val = data['age']
height_val = data['height']
weight_val = data['weight']
gender_val = data['gender']
supplements_val = str(data['supplements'])
activity_level_val = data['activity_level']
food_allergies_val = data['food_allergies']
eating_habits_val = data['eating_habits']
goal_val = data['goal']
water_consump_val = data['water_consump']
pregnant_val = str(data['pregnant'])
diet_plan_val = data['diet_plan']
health_problems_val = data['health_problems']
user_details = {
'name': name_val,
'age': age_val,
'height':height_val,
'weight':weight_val,
'gender':gender_val,
'activity level':activity_level_val,
'food allergies':food_allergies_val,
'eating habits':eating_habits_val,
'goal':goal_val,
'water consumption':water_consump_val,
'pregnant':pregnant_val,
'diet plans':diet_plan_val,
'health problems':health_problems_val,
'supplements consumption':supplements_val
}
print(user_details)
return("success")
@app.route('/signin', methods=['POST'])
def signin():
data = request.json
email_val = data['email']
mobile_val = data['mobile']
password_val = data['password']
signin_details = {
'email':email_val,
'mobile': mobile_val,
'password':password_val
}
print(signin_details)
return("success")
@app.route('/login', methods=['POST'])
def login():
data = request.json
email_val = data['email']
password_val = data['password']
login_details = {
'email':email_val,
'password':password_val
}
print(login_details)
return("success")
@app.route('/output', methods=['GET'])
def output():
# data = {
# 'name' : "Girish",
# 'age' :"20"
# }
data ={
"ingredients": {
"caffeine": "A stimulant that helps to improve alertness and focus",
"taurine": "An amino acid that is involved in energy production and antioxidant protection",
"B vitamins (B2, B3, B5, B6, and B12)": "Vitamins that are involved in energy metabolism, brain function, and cell health",
"glucuronolactone": "A substance that is involved in energy production and detoxification",
"simple sugars (sucrose and glucose)": "Sugars that provide a quick source of energy",
"carbonated water": "Water that has been infused with carbon dioxide gas",
"sodium bicarbonate and magnesium carbonate (substituted in some flavours with a trisodium citrate/citric acid buffer, each solution providing electrolytes)": "Electrolytes are minerals that help to regulate fluid balance and muscle function",
"acesulfame K and aspartame or sucralose": "Artificial sweeteners that provide a sweet taste with no calories"
}
}
return data
@app.route('/upload-image', methods = ['POST'])
def upload_image():
uploaded_file = request.files['file']
if uploaded_file.filename != '':
# Save the uploaded file
uploaded_file.save(uploaded_file.filename)
return "Image uploaded successfully."
else:
return "No Image received."
@app.route('/camera-image', methods = ['POST'])
def camera_image():
uploaded_file = request.files['file']
if uploaded_file.filename != '':
# Save the uploaded file
uploaded_file.save(uploaded_file.filename)
return "Image uploaded successfully."
else:
return "No Image received."
if __name__ == "__main__":
app.run(debug=True)