Spaces:
Runtime error
Runtime error
harry-stark
commited on
Commit
·
2bf97c9
1
Parent(s):
17a8518
Optimised inputs using st.form container
Browse files- __pycache__/hf_model.cpython-38.pyc +0 -0
- __pycache__/utils.cpython-38.pyc +0 -0
- app.py +12 -8
__pycache__/hf_model.cpython-38.pyc
ADDED
Binary file (833 Bytes). View file
|
|
__pycache__/utils.cpython-38.pyc
ADDED
Binary file (814 Bytes). View file
|
|
app.py
CHANGED
@@ -7,16 +7,20 @@ if __name__ == '__main__':
|
|
7 |
st.header("Zero Shot Classification")
|
8 |
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
|
14 |
-
|
15 |
-
st.write('Enter some text and at least one possible topic to see predictions.')
|
16 |
|
17 |
multi_class = st.checkbox('Allow multiple correct topics', value=True)
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
|
|
|
7 |
st.header("Zero Shot Classification")
|
8 |
|
9 |
|
10 |
+
with st.form(key='my_form'):
|
11 |
+
text_input = st.text_area(label="Input Sequence")
|
12 |
+
labels = st.text_input('Possible topics (separated by `,`)', max_chars=1000)
|
13 |
+
submit_button = st.form_submit_button(label='Submit')
|
14 |
+
|
15 |
+
|
16 |
labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
|
17 |
+
|
|
|
18 |
|
19 |
multi_class = st.checkbox('Allow multiple correct topics', value=True)
|
20 |
|
21 |
+
if st.button("Predict"):
|
22 |
+
if len(labels) == 0:
|
23 |
+
st.write('Enter some text and at least one possible topic to see predictions.')
|
24 |
+
top_topics, scores = classifier_zero(classifier,sequence=text_input,labels=labels,multi_class=multi_class)
|
25 |
+
plot_result(top_topics[::-1][-10:], scores[::-1][-10:])
|
26 |
|