Spaces:
Build error
Build error
Upload 10 files
Browse files- 20240527-000000-model.tar.gz +3 -0
- README.md +31 -14
- app.py +17 -0
- config.yml +19 -0
- domain.yml +18 -0
- endpoints.yml +3 -0
- nlu.yml +21 -0
- requirements.txt +3 -0
- rules.yml +7 -0
- stories.yml +17 -0
20240527-000000-model.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3951453fb265e96320586b84c5321544891c7f276996e25505e5ba55336b5381
|
| 3 |
+
size 170
|
README.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Somali Rasa Bot 🤖🇸🇴
|
| 2 |
+
|
| 3 |
+
This is a sample Rasa chatbot trained on Somali greetings, farewells, and thank-you intents. Deployed with Gradio on Hugging Face Spaces.
|
| 4 |
+
|
| 5 |
+
## How to Run
|
| 6 |
+
|
| 7 |
+
1. **Install dependencies**:
|
| 8 |
+
```
|
| 9 |
+
pip install -r requirements.txt
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
2. **Train the model**:
|
| 13 |
+
```
|
| 14 |
+
rasa train
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
3. **Run the Rasa server**:
|
| 18 |
+
```
|
| 19 |
+
rasa run --enable-api
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
4. **Run the Gradio app**:
|
| 23 |
+
```
|
| 24 |
+
python app.py
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Features
|
| 28 |
+
|
| 29 |
+
- Somali language intents
|
| 30 |
+
- Minimal Rasa bot for demo
|
| 31 |
+
- Gradio frontend for user interaction
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import requests
|
| 4 |
+
|
| 5 |
+
def chat_with_bot(message):
|
| 6 |
+
payload = {
|
| 7 |
+
"sender": "test_user",
|
| 8 |
+
"message": message
|
| 9 |
+
}
|
| 10 |
+
response = requests.post("http://localhost:5005/webhooks/rest/webhook", json=payload)
|
| 11 |
+
bot_reply = ""
|
| 12 |
+
for r in response.json():
|
| 13 |
+
bot_reply += r.get("text", "") + " "
|
| 14 |
+
return bot_reply.strip()
|
| 15 |
+
|
| 16 |
+
iface = gr.Interface(fn=chat_with_bot, inputs="text", outputs="text", title="Somali Rasa Bot")
|
| 17 |
+
iface.launch()
|
config.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
language: en
|
| 3 |
+
pipeline:
|
| 4 |
+
- name: WhitespaceTokenizer
|
| 5 |
+
- name: CountVectorsFeaturizer
|
| 6 |
+
- name: DIETClassifier
|
| 7 |
+
- name: EntitySynonymMapper
|
| 8 |
+
- name: ResponseSelector
|
| 9 |
+
retrieval_intent: faq
|
| 10 |
+
- name: FallbackClassifier
|
| 11 |
+
threshold: 0.3
|
| 12 |
+
ambiguity_threshold: 0.1
|
| 13 |
+
|
| 14 |
+
policies:
|
| 15 |
+
- name: MemoizationPolicy
|
| 16 |
+
- name: RulePolicy
|
| 17 |
+
- name: UnexpecTEDIntentPolicy
|
| 18 |
+
max_history: 5
|
| 19 |
+
epochs: 100
|
domain.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
version: "3.1"
|
| 3 |
+
intents:
|
| 4 |
+
- greet
|
| 5 |
+
- goodbye
|
| 6 |
+
- thank_you
|
| 7 |
+
|
| 8 |
+
responses:
|
| 9 |
+
utter_greet:
|
| 10 |
+
- text: "Waad salaaman tahay!"
|
| 11 |
+
utter_goodbye:
|
| 12 |
+
- text: "Nabad gelyo!"
|
| 13 |
+
utter_thank_you:
|
| 14 |
+
- text: "Adigaa mudan!"
|
| 15 |
+
|
| 16 |
+
session_config:
|
| 17 |
+
session_expiration_time: 60
|
| 18 |
+
carry_over_slots_to_new_session: true
|
endpoints.yml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
action_endpoint:
|
| 3 |
+
url: "http://localhost:5055/webhook"
|
nlu.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
version: "3.1"
|
| 3 |
+
nlu:
|
| 4 |
+
- intent: greet
|
| 5 |
+
examples: |
|
| 6 |
+
- Iska warran
|
| 7 |
+
- Nabad baa
|
| 8 |
+
- Subax wanaagsan
|
| 9 |
+
- Ma jirtaa cid i maqasha?
|
| 10 |
+
|
| 11 |
+
- intent: goodbye
|
| 12 |
+
examples: |
|
| 13 |
+
- Nabad gelyo
|
| 14 |
+
- Ilaa iyo markale
|
| 15 |
+
- Ilaahay ku nabad yeelo
|
| 16 |
+
- Habeen wanaagsan
|
| 17 |
+
|
| 18 |
+
- intent: thank_you
|
| 19 |
+
examples: |
|
| 20 |
+
- Mahadsanid
|
| 21 |
+
- Aad baad u mahadsantahay
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
rasa
|
| 2 |
+
gradio
|
| 3 |
+
requests
|
rules.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
version: "3.1"
|
| 3 |
+
rules:
|
| 4 |
+
- rule: Say goodbye anytime the user says goodbye
|
| 5 |
+
steps:
|
| 6 |
+
- intent: goodbye
|
| 7 |
+
- action: utter_goodbye
|
stories.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
version: "3.1"
|
| 3 |
+
stories:
|
| 4 |
+
- story: greet path
|
| 5 |
+
steps:
|
| 6 |
+
- intent: greet
|
| 7 |
+
- action: utter_greet
|
| 8 |
+
|
| 9 |
+
- story: goodbye path
|
| 10 |
+
steps:
|
| 11 |
+
- intent: goodbye
|
| 12 |
+
- action: utter_goodbye
|
| 13 |
+
|
| 14 |
+
- story: thank you path
|
| 15 |
+
steps:
|
| 16 |
+
- intent: thank_you
|
| 17 |
+
- action: utter_thank_you
|