-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
executable file
·33 lines (24 loc) · 822 Bytes
/
app.py
File metadata and controls
executable file
·33 lines (24 loc) · 822 Bytes
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
#!/usr/bin/python
from flask import Flask, jsonify, request
from getRecipe import Recipe
from getDetail import RecipeDetail
from imageRec import Image
app = Flask(__name__)
@app.route('/image', methods=['GET', 'POST'])
def imageRecog():
if request.method == 'POST':
image_file = request.files['image']
obj = Image(image_file.read())
return jsonify(obj.getIng())
@app.route('/recipes', methods=['GET'])
def getRecipe():
ing = request.args.get('ingredients')
page = request.args.get('page')
obj = Recipe(ing, page)
return jsonify(obj.returnRecipe())
@app.route('/recipe/<string:recipe_id>', methods=['GET'])
def getRecipes(recipe_id):
obj = RecipeDetail(recipe_id)
return jsonify(obj.return_detail())
if __name__ == '__main__':
app.run(port=8000, debug=True)