Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ from collections import Counter
|
|
9 |
import numpy as np
|
10 |
from transformers import pipeline
|
11 |
classifier = pipeline('sentiment-analysis')
|
|
|
12 |
#hashtag_phrase ="#datascience"
|
13 |
#recent_tweet_count_you_want =100
|
14 |
def search_hashtag1(hashtag_phrase,recent_tweet_count_you_want):
|
@@ -48,14 +49,18 @@ def search_hashtag1(hashtag_phrase,recent_tweet_count_you_want):
|
|
48 |
q=[p[i]['label'] for i in range(len(p))]
|
49 |
data10=pd.DataFrame(q,columns={"sentiment"})
|
50 |
data_tweet_final=pd.concat([data6,data10],axis=1)
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
#data6.to_csv("tweet_data1.csv")
|
53 |
#data6=data5.head(10)
|
54 |
-
return
|
55 |
iface = gr.Interface(
|
56 |
search_hashtag1,inputs=["text","number"],
|
57 |
outputs="dataframe",
|
58 |
-
examples=[["#datascience",
|
59 |
theme="seafoam",
|
60 |
title='Sakil Tweetlib6 App',
|
61 |
description="You can extract tweets based on Hashtag.e.g. Please enter #datascience. The app extracts tweets based on the hashtag and the number of tweet count you want.")
|
|
|
9 |
import numpy as np
|
10 |
from transformers import pipeline
|
11 |
classifier = pipeline('sentiment-analysis')
|
12 |
+
summarizer= pipeline("summarization", max_length=10)
|
13 |
#hashtag_phrase ="#datascience"
|
14 |
#recent_tweet_count_you_want =100
|
15 |
def search_hashtag1(hashtag_phrase,recent_tweet_count_you_want):
|
|
|
49 |
q=[p[i]['label'] for i in range(len(p))]
|
50 |
data10=pd.DataFrame(q,columns={"sentiment"})
|
51 |
data_tweet_final=pd.concat([data6,data10],axis=1)
|
52 |
+
p_summarize_label = [i for i in summarizer(tweet_list)]
|
53 |
+
q_summarize=[p_summarize_label[i]['summary_text'] for i in range(len(p_summarize_label))]
|
54 |
+
data_summarize=pd.DataFrame(q_summarize,columns={"summarized_tweets"})
|
55 |
+
data_tweet_summarize_final=pd.concat([data_tweet_final,data_summarize],axis=1)
|
56 |
+
data_tweet_summarize_final.to_csv("tweet_data2.csv")
|
57 |
#data6.to_csv("tweet_data1.csv")
|
58 |
#data6=data5.head(10)
|
59 |
+
return data_tweet_summarize_final
|
60 |
iface = gr.Interface(
|
61 |
search_hashtag1,inputs=["text","number"],
|
62 |
outputs="dataframe",
|
63 |
+
examples=[["#datascience",5],["#valentine's day",10],["#pushpa",15],["#budget",20],["#sharktankindia",30]],
|
64 |
theme="seafoam",
|
65 |
title='Sakil Tweetlib6 App',
|
66 |
description="You can extract tweets based on Hashtag.e.g. Please enter #datascience. The app extracts tweets based on the hashtag and the number of tweet count you want.")
|