Spaces:
Runtime error
Runtime error
Paula Leonova
commited on
Commit
•
96aa704
1
Parent(s):
6d47b6a
Add radio for ground truth
Browse files- app.py +11 -2
- examples.json +2 -1
- utils.py +1 -1
app.py
CHANGED
@@ -10,7 +10,7 @@ from models import create_nest_sentences, load_summary_model, summarizer_gen, lo
|
|
10 |
from utils import plot_result, plot_dual_bar_chart, examples_load, example_long_text_load
|
11 |
import json
|
12 |
|
13 |
-
ex_text, ex_license, ex_labels = examples_load()
|
14 |
ex_long_text = example_long_text_load()
|
15 |
|
16 |
|
@@ -28,8 +28,17 @@ with st.form(key='my_form'):
|
|
28 |
if text_input == display_text:
|
29 |
text_input = example_text
|
30 |
|
31 |
-
labels = st.text_input('
|
32 |
labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
submit_button = st.form_submit_button(label='Submit')
|
34 |
|
35 |
|
|
|
10 |
from utils import plot_result, plot_dual_bar_chart, examples_load, example_long_text_load
|
11 |
import json
|
12 |
|
13 |
+
ex_text, ex_license, ex_labels, ex_glabels = examples_load()
|
14 |
ex_long_text = example_long_text_load()
|
15 |
|
16 |
|
|
|
28 |
if text_input == display_text:
|
29 |
text_input = example_text
|
30 |
|
31 |
+
labels = st.text_input('Enter possible labels (comma-separated):',ex_labels, max_chars=1000)
|
32 |
labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
|
33 |
+
|
34 |
+
radio = st.radio(
|
35 |
+
"Are ground truth labels available?",
|
36 |
+
('Yes','No'))
|
37 |
+
|
38 |
+
if radio == 'Yes':
|
39 |
+
glabels = st.text_input('Enter known labels (comma-separated):',ex_glabels, max_chars=1000)
|
40 |
+
glabels = list(set([x.strip() for x in glabels.strip().split(',') if len(x.strip()) > 0]))
|
41 |
+
|
42 |
submit_button = st.form_submit_button(label='Submit')
|
43 |
|
44 |
|
examples.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
{
|
2 |
"text": "Such were the professor’s words—rather let me say such the words of the fate—enounced to destroy me. As he went on I felt as if my soul were grappling with a palpable enemy; one by one the various keys were touched which formed the mechanism of my being; chord after chord was sounded, and soon my mind was filled with one thought, one conception, one purpose. So much has been done, exclaimed the soul of Frankenstein—more, far more, will I achieve; treading in the steps already marked, I will pioneer a new way, explore unknown powers, and unfold to the world the deepest mysteries of creation.",
|
3 |
"long_text_license": "[This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.]",
|
4 |
-
"labels":"Batman,Science,Sound,Light,Creation,Optics,Eyes,Engineering,Color,Communication,Death"
|
|
|
5 |
}
|
|
|
1 |
{
|
2 |
"text": "Such were the professor’s words—rather let me say such the words of the fate—enounced to destroy me. As he went on I felt as if my soul were grappling with a palpable enemy; one by one the various keys were touched which formed the mechanism of my being; chord after chord was sounded, and soon my mind was filled with one thought, one conception, one purpose. So much has been done, exclaimed the soul of Frankenstein—more, far more, will I achieve; treading in the steps already marked, I will pioneer a new way, explore unknown powers, and unfold to the world the deepest mysteries of creation.",
|
3 |
"long_text_license": "[This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.]",
|
4 |
+
"labels":"Batman,Science,Sound,Light,Creation,Optics,Eyes,Engineering,Color,Communication,Death",
|
5 |
+
"ground_labels":"Science,Sound,Light,Creation,,Engineering,Communication,Death"
|
6 |
}
|
utils.py
CHANGED
@@ -77,7 +77,7 @@ def plot_dual_bar_chart(topics_summary, scores_summary, topics_text, scores_text
|
|
77 |
def examples_load():
|
78 |
with open("examples.json") as f:
|
79 |
data=json.load(f)
|
80 |
-
return data['text'], data['long_text_license'], data['labels']
|
81 |
|
82 |
def example_long_text_load():
|
83 |
with open("example_long_text.txt", "r") as f:
|
|
|
77 |
def examples_load():
|
78 |
with open("examples.json") as f:
|
79 |
data=json.load(f)
|
80 |
+
return data['text'], data['long_text_license'], data['labels'], data['ground_labels']
|
81 |
|
82 |
def example_long_text_load():
|
83 |
with open("example_long_text.txt", "r") as f:
|