Spaces:
Runtime error
Runtime error
wira.indra
commited on
Commit
·
c5b3056
1
Parent(s):
38d1024
add twitter feature
Browse files
app.py
CHANGED
|
@@ -52,17 +52,6 @@ def twitter_analyzer(keyword, max_tweets):
|
|
| 52 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
| 53 |
return fig, df[["URL", "Text", "Label", "Score"]]
|
| 54 |
|
| 55 |
-
sentiment_demo = gr.Interface(
|
| 56 |
-
fn=sentiment_analysis,
|
| 57 |
-
inputs="text",
|
| 58 |
-
outputs="label")
|
| 59 |
-
|
| 60 |
-
ner_demo = gr.Interface(
|
| 61 |
-
ner,
|
| 62 |
-
"text",
|
| 63 |
-
gr.HighlightedText(),
|
| 64 |
-
examples=examples)
|
| 65 |
-
|
| 66 |
if __name__ == "__main__":
|
| 67 |
|
| 68 |
with gr.Blocks() as demo:
|
|
@@ -75,6 +64,20 @@ if __name__ == "__main__":
|
|
| 75 |
)
|
| 76 |
|
| 77 |
with gr.Tab("Single Input"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
Parallel(
|
| 79 |
sentiment_demo, ner_demo,
|
| 80 |
inputs=gr.Textbox(lines=10, label="Input Text", placeholder="Enter sentences here..."),
|
|
|
|
| 52 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
| 53 |
return fig, df[["URL", "Text", "Label", "Score"]]
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
if __name__ == "__main__":
|
| 56 |
|
| 57 |
with gr.Blocks() as demo:
|
|
|
|
| 64 |
)
|
| 65 |
|
| 66 |
with gr.Tab("Single Input"):
|
| 67 |
+
sentiment_demo = gr.Interface(
|
| 68 |
+
fn=sentiment_analysis,
|
| 69 |
+
inputs="text",
|
| 70 |
+
outputs="label"
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
ner_demo = gr.Interface(
|
| 74 |
+
ner,
|
| 75 |
+
"text",
|
| 76 |
+
gr.HighlightedText(),
|
| 77 |
+
examples=examples,
|
| 78 |
+
allow_flagging='never'
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
Parallel(
|
| 82 |
sentiment_demo, ner_demo,
|
| 83 |
inputs=gr.Textbox(lines=10, label="Input Text", placeholder="Enter sentences here..."),
|