Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,45 @@ tokenizer = AutoTokenizer.from_pretrained("tuantc/flysugarbot")
|
|
| 6 |
model = AutoModelForSequenceClassification.from_pretrained("tuantc/flysugarbot")
|
| 7 |
model.eval()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def predict_intent(model, tokenizer, text_instance,label_map):
|
| 11 |
device = torch.device("cpu")
|
|
@@ -29,4 +68,4 @@ gr.Interface(
|
|
| 29 |
inputs=["text", "state"],
|
| 30 |
outputs=["chatbot", "state"],
|
| 31 |
theme="finlaymacklon/boxy_violet",
|
| 32 |
-
).launch()
|
|
|
|
| 6 |
model = AutoModelForSequenceClassification.from_pretrained("tuantc/flysugarbot")
|
| 7 |
model.eval()
|
| 8 |
|
| 9 |
+
classes = ['admin_hr_avi_hr_lead',
|
| 10 |
+
'airbus_avi_hr_lead',
|
| 11 |
+
'avi_hr_lead',
|
| 12 |
+
'bot_challenge',
|
| 13 |
+
'bus_info',
|
| 14 |
+
'c99_avi_hr_lead',
|
| 15 |
+
'card',
|
| 16 |
+
'channel_info',
|
| 17 |
+
'congras_general',
|
| 18 |
+
'contract',
|
| 19 |
+
'doc_email_sw',
|
| 20 |
+
'dxg_avi_hr_lead',
|
| 21 |
+
'empl_password',
|
| 22 |
+
'encourage',
|
| 23 |
+
'excited',
|
| 24 |
+
'fly_avi_hr_lead',
|
| 25 |
+
'general_spam',
|
| 26 |
+
'goodbye',
|
| 27 |
+
'greeting',
|
| 28 |
+
'laptop_pc',
|
| 29 |
+
'lover_spam',
|
| 30 |
+
'meeting_room',
|
| 31 |
+
'on_leave',
|
| 32 |
+
'palantir_avi_hr_lead',
|
| 33 |
+
'printer',
|
| 34 |
+
'property',
|
| 35 |
+
'salary_insurance_avi_hr_lead',
|
| 36 |
+
'services',
|
| 37 |
+
'spam_eating',
|
| 38 |
+
'sw_install',
|
| 39 |
+
'thoi_viec',
|
| 40 |
+
'tms',
|
| 41 |
+
'union',
|
| 42 |
+
'wifi',
|
| 43 |
+
'working_hour']
|
| 44 |
+
NUM_LABELS = len(classes)
|
| 45 |
+
label_map = {}
|
| 46 |
+
for l in range(NUM_LABELS):
|
| 47 |
+
label_map[l] = classes[l]
|
| 48 |
|
| 49 |
def predict_intent(model, tokenizer, text_instance,label_map):
|
| 50 |
device = torch.device("cpu")
|
|
|
|
| 68 |
inputs=["text", "state"],
|
| 69 |
outputs=["chatbot", "state"],
|
| 70 |
theme="finlaymacklon/boxy_violet",
|
| 71 |
+
).launch(share=True)
|