Spaces:
Sleeping
Sleeping
ghengx
commited on
Commit
·
98cce0f
1
Parent(s):
996f89b
init
Browse files- __init__.py +0 -0
- app.py +17 -0
- dataset_loader.py +16 -0
- requirements.txt +74 -0
__init__.py
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dataset_loader import load_dataset
|
| 3 |
+
|
| 4 |
+
if not os.path.isdir('agent_function'):
|
| 5 |
+
load_dataset()
|
| 6 |
+
|
| 7 |
+
import gradio as gr
|
| 8 |
+
from agent_function.agent import Agent
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=Agent().ask,
|
| 12 |
+
inputs=gr.components.Textbox(lines=7, label="Enter your text"),
|
| 13 |
+
outputs="text",
|
| 14 |
+
title="BNM Scam Awareness ChatBot",
|
| 15 |
+
description="""Learn how to protect yourself from scam with Bank Negara Malaysia."""
|
| 16 |
+
)
|
| 17 |
+
iface.launch(share=False)
|
dataset_loader.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import Repository
|
| 2 |
+
from huggingface_hub import login
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def load_dataset():
|
| 6 |
+
login(token = os.environ['HUB_TOKEN'])
|
| 7 |
+
|
| 8 |
+
repo = Repository(
|
| 9 |
+
local_dir="agent_function",
|
| 10 |
+
repo_type="dataset",
|
| 11 |
+
clone_from="gheng/bnm_scam_awareness",
|
| 12 |
+
token=True
|
| 13 |
+
)
|
| 14 |
+
repo.git_pull()
|
| 15 |
+
|
| 16 |
+
load_dataset()
|
requirements.txt
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
boto3==1.29.3
|
| 7 |
+
botocore==1.32.3
|
| 8 |
+
certifi==2023.11.17
|
| 9 |
+
charset-normalizer==3.3.2
|
| 10 |
+
click==8.1.7
|
| 11 |
+
colorama==0.4.6
|
| 12 |
+
contourpy==1.2.0
|
| 13 |
+
cycler==0.12.1
|
| 14 |
+
distro==1.8.0
|
| 15 |
+
fastapi==0.104.1
|
| 16 |
+
ffmpy==0.3.1
|
| 17 |
+
filelock==3.13.1
|
| 18 |
+
fonttools==4.44.3
|
| 19 |
+
fsspec==2023.10.0
|
| 20 |
+
gradio==4.4.1
|
| 21 |
+
gradio_client==0.7.0
|
| 22 |
+
h11==0.14.0
|
| 23 |
+
httpcore==1.0.2
|
| 24 |
+
httpx==0.25.1
|
| 25 |
+
huggingface-hub==0.19.4
|
| 26 |
+
idna==3.4
|
| 27 |
+
importlib-resources==6.1.1
|
| 28 |
+
Jinja2==3.1.2
|
| 29 |
+
jmespath==1.0.1
|
| 30 |
+
joblib==1.3.2
|
| 31 |
+
jsonschema==4.20.0
|
| 32 |
+
jsonschema-specifications==2023.11.1
|
| 33 |
+
kiwisolver==1.4.5
|
| 34 |
+
markdown-it-py==3.0.0
|
| 35 |
+
MarkupSafe==2.1.3
|
| 36 |
+
matplotlib==3.8.2
|
| 37 |
+
mdurl==0.1.2
|
| 38 |
+
numpy==1.26.2
|
| 39 |
+
openai==0.28.0
|
| 40 |
+
orjson==3.9.10
|
| 41 |
+
packaging==23.2
|
| 42 |
+
pandas==2.1.3
|
| 43 |
+
Pillow==10.1.0
|
| 44 |
+
pydantic==2.5.1
|
| 45 |
+
pydantic_core==2.14.3
|
| 46 |
+
pydub==0.25.1
|
| 47 |
+
Pygments==2.17.0
|
| 48 |
+
pyparsing==3.1.1
|
| 49 |
+
python-dateutil==2.8.2
|
| 50 |
+
python-multipart==0.0.6
|
| 51 |
+
pytz==2023.3.post1
|
| 52 |
+
PyYAML==6.0.1
|
| 53 |
+
referencing==0.31.0
|
| 54 |
+
requests==2.31.0
|
| 55 |
+
rich==13.7.0
|
| 56 |
+
rpds-py==0.13.0
|
| 57 |
+
s3transfer==0.7.0
|
| 58 |
+
scikit-learn==1.3.2
|
| 59 |
+
scipy==1.11.3
|
| 60 |
+
semantic-version==2.10.0
|
| 61 |
+
shellingham==1.5.4
|
| 62 |
+
six==1.16.0
|
| 63 |
+
sniffio==1.3.0
|
| 64 |
+
starlette==0.27.0
|
| 65 |
+
threadpoolctl==3.2.0
|
| 66 |
+
tomlkit==0.12.0
|
| 67 |
+
toolz==0.12.0
|
| 68 |
+
tqdm==4.66.1
|
| 69 |
+
typer==0.9.0
|
| 70 |
+
typing_extensions==4.8.0
|
| 71 |
+
tzdata==2023.3
|
| 72 |
+
urllib3==2.0.7
|
| 73 |
+
uvicorn==0.24.0.post1
|
| 74 |
+
websockets==11.0.3
|