Spaces:
Sleeping
Sleeping
Add another example
Browse files
app.py
CHANGED
@@ -5,19 +5,29 @@ from intent_classifier.model import IntentClassifier
|
|
5 |
|
6 |
@st.cache_resource
|
7 |
def load_model(model_name="Serj/intent-classifier", device=None):
|
8 |
-
st.write(f"model path: {model_name}")
|
9 |
m = IntentClassifier(model_name=model_name, device=device)
|
10 |
return m
|
11 |
|
12 |
|
13 |
model = load_model()
|
14 |
|
|
|
15 |
# text = "Hey, I want to stop my subscription. Can I do that?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
text = "I was expecting my card to get this week and I'm wandering why didn't I receive it yet?"
|
17 |
input = st.text_area("text", value=text)
|
18 |
prompt_options_values = " # how do I locate my card # my card hasn't arrived yet # I would like to reactivate my card # where do I link my card? # How do I re add my card? # how do I add the card to my account? # status of the card order "
|
19 |
prompt_options = st.text_area("prompt_options", value=prompt_options_values)
|
20 |
-
is_clicked = st.button("Submit")
|
21 |
if is_clicked:
|
22 |
output = model.structured_predict(input, prompt_options, print_input=True)
|
23 |
st.write(output)
|
|
|
5 |
|
6 |
@st.cache_resource
|
7 |
def load_model(model_name="Serj/intent-classifier", device=None):
|
8 |
+
# st.write(f"model path: {model_name}")
|
9 |
m = IntentClassifier(model_name=model_name, device=device)
|
10 |
return m
|
11 |
|
12 |
|
13 |
model = load_model()
|
14 |
|
15 |
+
st.title("Simple Labels")
|
16 |
# text = "Hey, I want to stop my subscription. Can I do that?"
|
17 |
+
text = "How do I get my money back?"
|
18 |
+
input = st.text_area("text", value=text)
|
19 |
+
prompt_options = st.text_area("prompt_options", value="# renew subscription # account deletion # cancel subscription # resume subscription # refund requests # other # general # item damaged # malfunction # hello # intro # question")
|
20 |
+
is_clicked = st.button("Submit", key="submit smile")
|
21 |
+
if is_clicked:
|
22 |
+
output = model.predict(input, prompt_options)
|
23 |
+
st.write(output)
|
24 |
+
|
25 |
+
st.title("Complex labels")
|
26 |
text = "I was expecting my card to get this week and I'm wandering why didn't I receive it yet?"
|
27 |
input = st.text_area("text", value=text)
|
28 |
prompt_options_values = " # how do I locate my card # my card hasn't arrived yet # I would like to reactivate my card # where do I link my card? # How do I re add my card? # how do I add the card to my account? # status of the card order "
|
29 |
prompt_options = st.text_area("prompt_options", value=prompt_options_values)
|
30 |
+
is_clicked = st.button("Submit", key="submit complex")
|
31 |
if is_clicked:
|
32 |
output = model.structured_predict(input, prompt_options, print_input=True)
|
33 |
st.write(output)
|