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