Spaces:
Runtime error
Runtime error
wira.indra
commited on
Commit
·
6f191b8
1
Parent(s):
572a5c1
add twitter feature
Browse files
app.py
CHANGED
|
@@ -77,12 +77,12 @@ def twitter_analyzer(keyword, max_tweets):
|
|
| 77 |
df["Text"] = df["Text"].apply(ts.preprocess_text)
|
| 78 |
df = sentiment_df(df)
|
| 79 |
|
| 80 |
-
df_ner = ner_df(df)
|
| 81 |
-
df_ner = df_ner[df_ner.Entity != keyword]
|
| 82 |
|
| 83 |
fig = plt.figure()
|
| 84 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
| 85 |
-
return fig, df[["URL", "Text", "Label", "Score"]]
|
| 86 |
|
| 87 |
if __name__ == "__main__":
|
| 88 |
|
|
@@ -122,17 +122,17 @@ if __name__ == "__main__":
|
|
| 122 |
overflow_row_behaviour='paginate',
|
| 123 |
wrap=True)
|
| 124 |
|
| 125 |
-
df_ner = gr.DataFrame(type="pandas",
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
|
| 132 |
analyze_button.click(sentiment_ner, input_text, [sent_output, ner_output])
|
| 133 |
submit_button.click(twitter_analyzer,
|
| 134 |
inputs=[keyword_textbox, max_tweets_component],
|
| 135 |
-
outputs=[plot_component, dataframe_component
|
| 136 |
|
| 137 |
gr.Markdown(
|
| 138 |
"""
|
|
|
|
| 77 |
df["Text"] = df["Text"].apply(ts.preprocess_text)
|
| 78 |
df = sentiment_df(df)
|
| 79 |
|
| 80 |
+
# df_ner = ner_df(df)
|
| 81 |
+
# df_ner = df_ner[df_ner.Entity != keyword]
|
| 82 |
|
| 83 |
fig = plt.figure()
|
| 84 |
df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
|
| 85 |
+
return fig, df[["URL", "Text", "Label", "Score"]]
|
| 86 |
|
| 87 |
if __name__ == "__main__":
|
| 88 |
|
|
|
|
| 122 |
overflow_row_behaviour='paginate',
|
| 123 |
wrap=True)
|
| 124 |
|
| 125 |
+
# df_ner = gr.DataFrame(type="pandas",
|
| 126 |
+
# label="Dataframe",
|
| 127 |
+
# max_rows=(20,'fixed'),
|
| 128 |
+
# overflow_row_behaviour='paginate',
|
| 129 |
+
# wrap=True)
|
| 130 |
|
| 131 |
|
| 132 |
analyze_button.click(sentiment_ner, input_text, [sent_output, ner_output])
|
| 133 |
submit_button.click(twitter_analyzer,
|
| 134 |
inputs=[keyword_textbox, max_tweets_component],
|
| 135 |
+
outputs=[plot_component, dataframe_component])
|
| 136 |
|
| 137 |
gr.Markdown(
|
| 138 |
"""
|