Bruno commited on
Commit
eaad231
1 Parent(s): 62b63a1

Create appy.py

Browse files
Files changed (1) hide show
  1. appy.py +26 -0
appy.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("text-classification", model="Bruno/intent-classification-pt-setfit-model")
5
+
6
+ dictionary={'48':'alarm_set',
7
+ '46':'audio_volume_mute',
8
+ '1':'iot_hue_lightchange',
9
+ '40':'iot_hue_lightoff',
10
+ '34':'iot_cleaning',
11
+ }
12
+
13
+
14
+ def greet(text, dictionary=dictionary):
15
+ response = pipe(text)
16
+ return dictionary[response[0]['label']]
17
+
18
+ demo = gr.Interface(fn=greet,
19
+ inputs="text",
20
+ outputs="text",
21
+ title="Aamzon PT-br Intent Classifier",
22
+ description="Aamzon PT-br Intent Classifier",
23
+ examples=[["pausa por dez segundos"],["definir a iluminação adequada para leitura"],["aspirar a casa"]]
24
+ cache_examples=False)
25
+
26
+ demo.launch()