sync with internal
Browse files
app.py
CHANGED
@@ -18,8 +18,9 @@ game_list = [
|
|
18 |
|
19 |
functionality_list = [
|
20 |
"AI",
|
21 |
-
"
|
22 |
-
"
|
|
|
23 |
]
|
24 |
|
25 |
space = 'stevez-bbc123'
|
@@ -29,16 +30,16 @@ space = 'stevez-bbc123'
|
|
29 |
# url = f'https://{space}.hf.space/api/predict'
|
30 |
url = f'https://{space}.hf.space'
|
31 |
|
32 |
-
def run(hf_token, service, game,
|
33 |
if hf_token is None or hf_token == '':
|
34 |
return 'please specify hf token'
|
35 |
|
36 |
if service not in functionality_shared[1:]:
|
37 |
if game is None:
|
38 |
return "please specify which game"
|
39 |
-
if
|
40 |
return "please choose the AI functionality"
|
41 |
-
if
|
42 |
if nlp_command in ["", None]:
|
43 |
return "please make sure the command is not empty"
|
44 |
|
@@ -62,7 +63,7 @@ def run(hf_token, service, game, r, nlp_command):
|
|
62 |
hf_token=hf_token,
|
63 |
)
|
64 |
res = client.predict(
|
65 |
-
service, game,
|
66 |
api_name='/predict',
|
67 |
)
|
68 |
res2 = json.loads(res[0])
|
|
|
18 |
|
19 |
functionality_list = [
|
20 |
"AI",
|
21 |
+
"functionality",
|
22 |
+
"json dedup",
|
23 |
+
"json",
|
24 |
]
|
25 |
|
26 |
space = 'stevez-bbc123'
|
|
|
30 |
# url = f'https://{space}.hf.space/api/predict'
|
31 |
url = f'https://{space}.hf.space'
|
32 |
|
33 |
+
def run(hf_token, service, game, functionality, nlp_command):
|
34 |
if hf_token is None or hf_token == '':
|
35 |
return 'please specify hf token'
|
36 |
|
37 |
if service not in functionality_shared[1:]:
|
38 |
if game is None:
|
39 |
return "please specify which game"
|
40 |
+
if functionality is None:
|
41 |
return "please choose the AI functionality"
|
42 |
+
if functionality == 'AI':
|
43 |
if nlp_command in ["", None]:
|
44 |
return "please make sure the command is not empty"
|
45 |
|
|
|
63 |
hf_token=hf_token,
|
64 |
)
|
65 |
res = client.predict(
|
66 |
+
service, game, functionality, nlp_command,
|
67 |
api_name='/predict',
|
68 |
)
|
69 |
res2 = json.loads(res[0])
|