Spaces:
Runtime error
Runtime error
Commit
·
2f9d0c2
1
Parent(s):
042d1a1
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
from transformers import T5Tokenizer, T5Model, T5ForConditionalGeneration, pipeline
|
2 |
import nltk.data
|
3 |
|
|
|
|
|
4 |
|
5 |
import gradio as gr
|
6 |
from gradio.mix import Parallel
|
@@ -74,7 +76,7 @@ def run(text):
|
|
74 |
ner_all = ner(text)
|
75 |
fig = plt.figure()
|
76 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
77 |
-
return summ_, sent_, ner_, fig, ner_all
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
with gr.Blocks() as demo:
|
@@ -98,5 +100,11 @@ if __name__ == "__main__":
|
|
98 |
plot_component = gr.Plot(label="Pie Chart of Sentiments")
|
99 |
ner_all_output = gr.HighlightedText(label="NER Article")
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
demo.launch()
|
|
|
1 |
from transformers import T5Tokenizer, T5Model, T5ForConditionalGeneration, pipeline
|
2 |
import nltk.data
|
3 |
|
4 |
+
nltk.download('punkt')
|
5 |
+
|
6 |
|
7 |
import gradio as gr
|
8 |
from gradio.mix import Parallel
|
|
|
76 |
ner_all = ner(text)
|
77 |
fig = plt.figure()
|
78 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
79 |
+
return summ_, sent_, ner_, fig, ner_all, df
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
with gr.Blocks() as demo:
|
|
|
100 |
plot_component = gr.Plot(label="Pie Chart of Sentiments")
|
101 |
ner_all_output = gr.HighlightedText(label="NER Article")
|
102 |
|
103 |
+
dataframe_component = gr.DataFrame(type="pandas",
|
104 |
+
label="Dataframe",
|
105 |
+
max_rows=(20,'fixed'),
|
106 |
+
overflow_row_behaviour='paginate',
|
107 |
+
wrap=True)
|
108 |
+
|
109 |
+
analyze_button.click(run, inputs=input_text, outputs=[summ_output, sent_output, ner_output, plot_component, ner_all_output, dataframe_component ])
|
110 |
demo.launch()
|