Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -18,7 +18,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 18 |
model = model.to(device)
|
| 19 |
|
| 20 |
# Open a thing for the API
|
| 21 |
-
@app.
|
| 22 |
def receive_data():
|
| 23 |
data = request.get_json()
|
| 24 |
|
|
@@ -39,8 +39,8 @@ def receive_data():
|
|
| 39 |
return jsonify(answer_data)
|
| 40 |
|
| 41 |
# Incase a normal browser opens the page
|
| 42 |
-
@app.
|
| 43 |
def not_api():
|
| 44 |
return render_template("index.html")
|
| 45 |
|
| 46 |
-
app.run(debug=False, port=7860)
|
|
|
|
| 18 |
model = model.to(device)
|
| 19 |
|
| 20 |
# Open a thing for the API
|
| 21 |
+
@app.post("/api")
|
| 22 |
def receive_data():
|
| 23 |
data = request.get_json()
|
| 24 |
|
|
|
|
| 39 |
return jsonify(answer_data)
|
| 40 |
|
| 41 |
# Incase a normal browser opens the page
|
| 42 |
+
@app.get("/")
|
| 43 |
def not_api():
|
| 44 |
return render_template("index.html")
|
| 45 |
|
| 46 |
+
app.run(debug=False, port=7860, load_dotenv=True)
|