Paweł Łaba
commited on
Commit
·
d69ff2d
1
Parent(s):
52eb98a
zmiany w index
Browse files
app.py
CHANGED
|
@@ -1,13 +1,17 @@
|
|
| 1 |
# app.py
|
| 2 |
-
from
|
| 3 |
-
from flask_cors import CORS
|
| 4 |
import numpy as np
|
| 5 |
from tensorflow import keras
|
| 6 |
import json
|
| 7 |
import os
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
class TicTacToeAI:
|
| 13 |
def __init__(self, model_path='model/model.keras'):
|
|
@@ -40,9 +44,6 @@ class TicTacToeAI:
|
|
| 40 |
# Inicjalizacja AI
|
| 41 |
ai = TicTacToeAI()
|
| 42 |
|
| 43 |
-
@app.route("/")
|
| 44 |
-
def home():
|
| 45 |
-
return render_template("public/index.html")
|
| 46 |
|
| 47 |
@app.route('/move', methods=['POST'])
|
| 48 |
def get_move():
|
|
@@ -138,6 +139,3 @@ def get_status():
|
|
| 138 |
'model_path': ai.model_path
|
| 139 |
})
|
| 140 |
|
| 141 |
-
if __name__ == '__main__':
|
| 142 |
-
import uvicorn
|
| 143 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 1 |
# app.py
|
| 2 |
+
from fastapi import FastAPI
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
from tensorflow import keras
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
|
| 8 |
+
|
| 9 |
+
app = FastAPI()
|
| 10 |
+
|
| 11 |
+
@app.get("/")
|
| 12 |
+
def read_root():
|
| 13 |
+
return render_template("public/index.html")
|
| 14 |
+
|
| 15 |
|
| 16 |
class TicTacToeAI:
|
| 17 |
def __init__(self, model_path='model/model.keras'):
|
|
|
|
| 44 |
# Inicjalizacja AI
|
| 45 |
ai = TicTacToeAI()
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
@app.route('/move', methods=['POST'])
|
| 49 |
def get_move():
|
|
|
|
| 139 |
'model_path': ai.model_path
|
| 140 |
})
|
| 141 |
|
|
|
|
|
|
|
|
|