Beracles
commited on
Commit
·
408959d
1
Parent(s):
71dcc06
unify interface
Browse files
app.py
CHANGED
|
@@ -67,24 +67,13 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 67 |
|
| 68 |
service_start = beijing()
|
| 69 |
print(f"<<<<<<<<<<<<<< service starts at {service_start} <<<<<<<<<<<<<<")
|
| 70 |
-
if service
|
| 71 |
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 72 |
-
|
|
|
|
| 73 |
outp = {"status": "Failure"}
|
| 74 |
else:
|
| 75 |
-
outp = {"status": "OK", "result":
|
| 76 |
-
elif service == "upload game":
|
| 77 |
-
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 78 |
-
if res is None:
|
| 79 |
-
outp = {"status": "Failure"}
|
| 80 |
-
else:
|
| 81 |
-
outp = {"status": "OK", "result": res}
|
| 82 |
-
elif service == "list games":
|
| 83 |
-
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 84 |
-
if res is None:
|
| 85 |
-
outp = {"status": "Failure"}
|
| 86 |
-
else:
|
| 87 |
-
outp = {"status": "OK", "result": json.loads(res)["result"]}
|
| 88 |
else:
|
| 89 |
assert "games" in service_list
|
| 90 |
if service == "games":
|
|
|
|
| 67 |
|
| 68 |
service_start = beijing()
|
| 69 |
print(f"<<<<<<<<<<<<<< service starts at {service_start} <<<<<<<<<<<<<<")
|
| 70 |
+
if service in ["download game", "upload game", "list games"]:
|
| 71 |
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 72 |
+
res = json.loads(res)
|
| 73 |
+
if res["result"] is None:
|
| 74 |
outp = {"status": "Failure"}
|
| 75 |
else:
|
| 76 |
+
outp = {"status": "OK", "result": res["result"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
else:
|
| 78 |
assert "games" in service_list
|
| 79 |
if service == "games":
|