Spaces:
Sleeping
Sleeping
Update server/app.py
Browse files- server/app.py +18 -7
server/app.py
CHANGED
|
@@ -24,17 +24,28 @@ def root():
|
|
| 24 |
task_list = ["easy", "medium", "hard"]
|
| 25 |
task_index = 0
|
| 26 |
|
| 27 |
-
@app.post("/
|
| 28 |
-
def
|
| 29 |
-
global state, done
|
| 30 |
-
|
| 31 |
-
task =
|
| 32 |
-
|
|
|
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
state = random.choice(emails)
|
| 35 |
-
state["task"] =
|
| 36 |
done = False
|
|
|
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
return {"state": state}
|
| 39 |
|
| 40 |
@app.post("/step")
|
|
|
|
| 24 |
task_list = ["easy", "medium", "hard"]
|
| 25 |
task_index = 0
|
| 26 |
|
| 27 |
+
@app.post("/reset_easy")
|
| 28 |
+
def reset_easy():
|
| 29 |
+
global state, done
|
| 30 |
+
state = random.choice(emails)
|
| 31 |
+
state["task"] = "easy"
|
| 32 |
+
done = False
|
| 33 |
+
return {"state": state}
|
| 34 |
|
| 35 |
+
@app.post("/reset_medium")
|
| 36 |
+
def reset_medium():
|
| 37 |
+
global state, done
|
| 38 |
state = random.choice(emails)
|
| 39 |
+
state["task"] = "medium"
|
| 40 |
done = False
|
| 41 |
+
return {"state": state}
|
| 42 |
|
| 43 |
+
@app.post("/reset_hard")
|
| 44 |
+
def reset_hard():
|
| 45 |
+
global state, done
|
| 46 |
+
state = random.choice(emails)
|
| 47 |
+
state["task"] = "hard"
|
| 48 |
+
done = False
|
| 49 |
return {"state": state}
|
| 50 |
|
| 51 |
@app.post("/step")
|