Mise en place d'update
This commit is contained in:
parent
b195b5d17e
commit
3ba341b415
3 changed files with 13 additions and 8 deletions
|
@ -12,7 +12,7 @@ def create_app():
|
|||
data=pd.read_csv("/Datasets/database/questions.csv",delimiter=",")
|
||||
data.to_sql('questions',con,if_exists='replace',index=False)
|
||||
|
||||
@app.route('/get_question/<int:id>/',methods=['GET'])
|
||||
@app.route('/question/<int:id>/',methods=['GET'])
|
||||
def get_question(id=1):
|
||||
with sql.connect("/Datasets/database/database.db") as con:
|
||||
cur = con.cursor()
|
||||
|
|
BIN
main/Dockerfiles/app/.entrypoint.sh.swp
Normal file
BIN
main/Dockerfiles/app/.entrypoint.sh.swp
Normal file
Binary file not shown.
|
@ -1,20 +1,25 @@
|
|||
# app/__init__.py
|
||||
|
||||
from flask import Flask
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/<string:id>')
|
||||
def create(id):
|
||||
@app.route('/update/<string:id>/<string:attr>/<int:value>/')
|
||||
def update(id,attr,value):
|
||||
import update_grid;
|
||||
path = "/Datasets/grids/"# PATH TO VOLUME
|
||||
r = requests.get("http://127.0.0.1:50011/update/"+id+"/"+attr+"/"+str(value)+"/")
|
||||
print("Message",file=sys.stdout)
|
||||
print(r,file=sys.stdout)
|
||||
dict = r.json()
|
||||
# TO DO
|
||||
# GET COORDINATES x and y
|
||||
x = 0.3
|
||||
y = 0.5
|
||||
nb_img = 24
|
||||
update_grid.hide_image(path+id+".png", path+id+".png", x,y)
|
||||
nb_img = dict["Nb"]
|
||||
for x,y in dict["img"]:
|
||||
update_grid.hide_image(path+id+".png", path+id+".png", float(x),float(y))
|
||||
return str(nb_img)
|
||||
|
||||
return app
|
||||
|
|
Loading…
Reference in a new issue