-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (23 loc) · 785 Bytes
/
main.py
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
from flask import Flask, request, jsonify,render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template('index.html')
# Define a route to handle the image classification
@app.route('/classify', methods=['POST'])
def classify_image():
# Handle the image classification logic here
# You'll need to extract the image from the request and use TensorFlow.js and Teachable Machine to classify it
# Placeholder response for now
response = {
'label': 'apple',
'confidence': 0.95,
'details': {
'nutritional_value': '...',
'origin': '...',
'seasonality': '...'
}
}
return jsonify(response)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)