Sakil commited on
Commit
71c5cf1
·
1 Parent(s): 7dc8563

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -7,7 +7,9 @@ import itertools
7
  import collections
8
  from collections import Counter
9
  import numpy as np
10
- def search_hashtag1(hashtag_phrase):
 
 
11
  #hashtag_phrase=input("Enter hashtahg")
12
  consumer_key="30GAxNeTfZuPL5SfNhFBodmRF"
13
  consumer_secret="C6O64nP0XjtwaAnXYL9zCcDZKEIP2iL1yVdlsNJtwLiZ5AEEBs"
@@ -21,7 +23,7 @@ def search_hashtag1(hashtag_phrase):
21
  timestamp=[]
22
  tweet_text=[]
23
  user_name=[]
24
- for tweet in tweepy.Cursor(api.search_tweets, q=hashtag_phrase+' -filter:retweets',lang="en", tweet_mode='extended').items(200):
25
  timestamp1=tweet.created_at
26
  timestamp.append(timestamp1)
27
  tweet_text1=tweet.full_text.replace('\n',' ').encode('utf-8')
@@ -39,8 +41,8 @@ def search_hashtag1(hashtag_phrase):
39
  iface = gr.Interface(
40
  search_hashtag1,inputs=gr.inputs.Textbox(lines=2, placeholder="Enter Hashtag Here"),
41
  outputs="dataframe",
42
- examples=["#datascience","#budget","#valentine's day","#pushpa","#batman","#SharkTankIndia"],
43
  theme="seafoam",
44
  title='Sakil Tweetlib6 App',
45
- description="You can extract tweets based on Hashtag.e.g. Please enter #datascience. The app extracts top 500 recent tweets based on the hashtag.")
46
  iface.launch(inline=False)
 
7
  import collections
8
  from collections import Counter
9
  import numpy as np
10
+ hashtag_phrase ="#datascience"
11
+ recent_tweet_count_you_want =100
12
+ def search_hashtag1(hashtag_phrase,recent_tweet_count_you_want):
13
  #hashtag_phrase=input("Enter hashtahg")
14
  consumer_key="30GAxNeTfZuPL5SfNhFBodmRF"
15
  consumer_secret="C6O64nP0XjtwaAnXYL9zCcDZKEIP2iL1yVdlsNJtwLiZ5AEEBs"
 
23
  timestamp=[]
24
  tweet_text=[]
25
  user_name=[]
26
+ for tweet in tweepy.Cursor(api.search_tweets, q=hashtag_phrase+' -filter:retweets',lang="en", tweet_mode='extended').items(recent_tweet_count_you_want):
27
  timestamp1=tweet.created_at
28
  timestamp.append(timestamp1)
29
  tweet_text1=tweet.full_text.replace('\n',' ').encode('utf-8')
 
41
  iface = gr.Interface(
42
  search_hashtag1,inputs=gr.inputs.Textbox(lines=2, placeholder="Enter Hashtag Here"),
43
  outputs="dataframe",
44
+ examples=[[hashtag_phrase,recent_tweet_count_you_want]],
45
  theme="seafoam",
46
  title='Sakil Tweetlib6 App',
47
+ 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.")
48
  iface.launch(inline=False)