quick fix
Browse files
app.py
CHANGED
|
@@ -44,7 +44,8 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 44 |
return "please make sure the command is not empty"
|
| 45 |
|
| 46 |
try:
|
| 47 |
-
|
|
|
|
| 48 |
# myobj = {
|
| 49 |
# 'data': [service, game, r, nlp_command],
|
| 50 |
# }
|
|
@@ -68,12 +69,9 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 68 |
api_name='/predict',
|
| 69 |
)
|
| 70 |
res2 = json.loads(res[0])
|
| 71 |
-
# print(json.dumps(res2, indent=4))
|
| 72 |
-
# if (r == 'greet') or (r == 'angry birds'):
|
| 73 |
-
# res2['demo-version'] = "2.0.0.2023-08-04-a" # use gradio_client
|
| 74 |
return json.dumps(res2, indent=4)
|
| 75 |
except Exception as e:
|
| 76 |
-
return f"{type(e)}, {str(e)}. \nyou
|
| 77 |
|
| 78 |
demo = gr.Interface(
|
| 79 |
fn=run,
|
|
|
|
| 44 |
return "please make sure the command is not empty"
|
| 45 |
|
| 46 |
try:
|
| 47 |
+
if service in functionality_shared[1:]:
|
| 48 |
+
print(f"{datetime.today()} [{game}]\t{nlp_command}")
|
| 49 |
# myobj = {
|
| 50 |
# 'data': [service, game, r, nlp_command],
|
| 51 |
# }
|
|
|
|
| 69 |
api_name='/predict',
|
| 70 |
)
|
| 71 |
res2 = json.loads(res[0])
|
|
|
|
|
|
|
|
|
|
| 72 |
return json.dumps(res2, indent=4)
|
| 73 |
except Exception as e:
|
| 74 |
+
return f"{type(e)}, {str(e)}. \nyou may want to make sure your hf_token is correct"
|
| 75 |
|
| 76 |
demo = gr.Interface(
|
| 77 |
fn=run,
|
req.txt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiofiles==23.2.1
|
| 2 |
+
altair==5.1.2
|
| 3 |
+
annotated-types==0.6.0
|
| 4 |
+
anyio==3.7.1
|
| 5 |
+
attrs==23.1.0
|
| 6 |
+
certifi==2023.7.22
|
| 7 |
+
charset-normalizer==3.3.0
|
| 8 |
+
click==8.1.7
|
| 9 |
+
contourpy==1.1.1
|
| 10 |
+
cycler==0.12.1
|
| 11 |
+
fastapi==0.103.2
|
| 12 |
+
ffmpy==0.3.1
|
| 13 |
+
filelock==3.12.4
|
| 14 |
+
fonttools==4.43.1
|
| 15 |
+
fsspec==2023.9.2
|
| 16 |
+
gradio==3.47.1
|
| 17 |
+
gradio_client==0.6.0
|
| 18 |
+
h11==0.14.0
|
| 19 |
+
httpcore==0.18.0
|
| 20 |
+
httpx==0.25.0
|
| 21 |
+
huggingface-hub==0.18.0
|
| 22 |
+
idna==3.4
|
| 23 |
+
importlib-resources==6.1.0
|
| 24 |
+
Jinja2==3.1.2
|
| 25 |
+
jsonschema==4.19.1
|
| 26 |
+
jsonschema-specifications==2023.7.1
|
| 27 |
+
kiwisolver==1.4.5
|
| 28 |
+
MarkupSafe==2.1.3
|
| 29 |
+
matplotlib==3.8.0
|
| 30 |
+
numpy==1.26.0
|
| 31 |
+
orjson==3.9.9
|
| 32 |
+
packaging==23.2
|
| 33 |
+
pandas==2.1.1
|
| 34 |
+
Pillow==10.0.1
|
| 35 |
+
pydantic==2.4.2
|
| 36 |
+
pydantic_core==2.10.1
|
| 37 |
+
pydub==0.25.1
|
| 38 |
+
pyparsing==3.1.1
|
| 39 |
+
python-dateutil==2.8.2
|
| 40 |
+
python-multipart==0.0.6
|
| 41 |
+
pytz==2023.3.post1
|
| 42 |
+
PyYAML==6.0.1
|
| 43 |
+
referencing==0.30.2
|
| 44 |
+
requests==2.31.0
|
| 45 |
+
rpds-py==0.10.6
|
| 46 |
+
semantic-version==2.10.0
|
| 47 |
+
six==1.16.0
|
| 48 |
+
sniffio==1.3.0
|
| 49 |
+
starlette==0.27.0
|
| 50 |
+
toolz==0.12.0
|
| 51 |
+
tqdm==4.66.1
|
| 52 |
+
typing_extensions==4.8.0
|
| 53 |
+
tzdata==2023.3
|
| 54 |
+
urllib3==2.0.6
|
| 55 |
+
uvicorn==0.23.2
|
| 56 |
+
websockets==11.0.3
|