User1342 commited on
Commit
c1493db
1 Parent(s): a9e135e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -237,13 +237,6 @@ def changed_tab():
237
  chatbot.value = chat_history
238
  chatbot.update(value=chat_history)
239
 
240
- oauth1_user_handler = tweepy.OAuth1UserHandler(
241
- consumer_token, consumer_secret,
242
- callback="https://hf.space/embed/User1342/WatchTower/"
243
- )
244
-
245
- target_website = oauth1_user_handler.get_authorization_url(signin_with_twitter=True)
246
-
247
 
248
  get_window_url_params = """
249
  function(text_input, url_params) {
@@ -254,6 +247,15 @@ get_window_url_params = """
254
  }
255
  """
256
 
 
 
 
 
 
 
 
 
 
257
  with block:
258
  gr.HTML('''
259
 
@@ -297,7 +299,7 @@ with block:
297
  with gr.Row().style(mobile_collapse=False, equal_height=True):
298
  gr.HTML(
299
  value='<a href={}><img src="https://cdn.cms-twdigitalassets.com/content/dam/developer-twitter/auth-docs/sign-in-with-twitter-gray.png.twimg.1920.png" alt="Log In With Twitter"></a><br>'.format(
300
- target_website))
301
  with gr.Row().style(mobile_collapse=False, equal_height=True):
302
  radio = gr.CheckboxGroup(value="Violent", choices=["Violent", "Hate Speech", "Misinformation"],
303
  interactive=False, label="Behaviour To Block")
 
237
  chatbot.value = chat_history
238
  chatbot.update(value=chat_history)
239
 
 
 
 
 
 
 
 
240
 
241
  get_window_url_params = """
242
  function(text_input, url_params) {
 
247
  }
248
  """
249
 
250
+ def get_target_website():
251
+ oauth1_user_handler = tweepy.OAuth1UserHandler(
252
+ consumer_token, consumer_secret,
253
+ callback="https://hf.space/embed/User1342/WatchTower/"
254
+ )
255
+ target_website = oauth1_user_handler.get_authorization_url(signin_with_twitter=True)
256
+
257
+ return target_website
258
+
259
  with block:
260
  gr.HTML('''
261
 
 
299
  with gr.Row().style(mobile_collapse=False, equal_height=True):
300
  gr.HTML(
301
  value='<a href={}><img src="https://cdn.cms-twdigitalassets.com/content/dam/developer-twitter/auth-docs/sign-in-with-twitter-gray.png.twimg.1920.png" alt="Log In With Twitter"></a><br>'.format(
302
+ get_target_website()))
303
  with gr.Row().style(mobile_collapse=False, equal_height=True):
304
  radio = gr.CheckboxGroup(value="Violent", choices=["Violent", "Hate Speech", "Misinformation"],
305
  interactive=False, label="Behaviour To Block")