Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from setfit import SetFitModel
|
3 |
+
|
4 |
+
l6_model = SetFitModel.from_pretrained("Bruno/intent-classification-pt-setfit-model")
|
5 |
+
|
6 |
+
st.title("A intenção classificada é")
|
7 |
+
|
8 |
+
Text = st.text_input("Enter the sentence")
|
9 |
+
|
10 |
+
|
11 |
+
@st.cache
|
12 |
+
def model_inference(text):
|
13 |
+
prediction = l6_model([text])
|
14 |
+
if prediction == 48:
|
15 |
+
return "alarm_set"
|
16 |
+
if prediction == 46:
|
17 |
+
return "audio_volume_mute"
|
18 |
+
if prediction == 1:
|
19 |
+
return "iot_hue_lightchange"
|
20 |
+
if prediction == 40:
|
21 |
+
return "iot_hue_lightoff"
|
22 |
+
if prediction == 34:
|
23 |
+
return "iot_cleaning"
|
24 |
+
else:
|
25 |
+
return "Others"
|
26 |
+
|
27 |
+
|
28 |
+
st.subheader('A intenção classificada é')
|
29 |
+
st.write(model_inference(Text))
|