Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,6 @@ list_of_servers = [
|
|
| 23 |
"mastodon.pirateparty.be",
|
| 24 |
"socel.net",
|
| 25 |
"mastodon.nz",
|
| 26 |
-
"toot.funami.tech",
|
| 27 |
"noc.social",
|
| 28 |
"seo.chat",
|
| 29 |
"ioc.exchange",
|
|
@@ -91,9 +90,7 @@ def get_auth_url(mastodon):
|
|
| 91 |
:param mastodon: A admin masterdon instance.
|
| 92 |
:return: The target URL.
|
| 93 |
'''
|
| 94 |
-
return mastodon.auth_request_url(client_id="ivory-secret.txt", scopes=["write:blocks", "write:mutes"]
|
| 95 |
-
redirect_uris="https://user1342-ivory.hf.space/")
|
| 96 |
-
|
| 97 |
|
| 98 |
def login_from_code(code):
|
| 99 |
'''
|
|
@@ -141,7 +138,7 @@ img {margin-bottom: -8px;}
|
|
| 141 |
<div class="w3-col">
|
| 142 |
<h1 class="w3-jumbo"><b>WatchTower ππ§</b></h1>
|
| 143 |
<h1 class="w3-xxxlarge w3-text-purple"><b>Remove Unfavorable Messages From Your Mastodon Feed </b></h1>
|
| 144 |
-
<p><span class="w3-xlarge">Scroll down to use WatchTower Ivory. β¬ </span> WatchTower is a tool that identifies hate speech, misinformation, and extremist content and blocks/ mutes it from your feed. WatchTower Ivory is the second iteration of WatchTower, designed specifically for Mastodon. WatchTower blocks content based on it's current database, so make sure to come back regularly to ensure you're up to date! We use a queue system, which means <b>you may need to wait your turn to run WatchTower<b> - however, once you've clicked run, you can close the tab as WatchTower will continue in the background. WatchTower is simple to use: first scroll down the page and click the Mastodon logo below, then you'll be taken to the Mastodon website and asked to verify yourself, after this you'll be taken back here, then simply scroll down to the bottom of the page and click run!</p>
|
| 145 |
<a href="https://www.watchtower.cartographer.one/"><button class="w3-button w3-light-grey w3-padding-large w3-section " onclick="document.getElementById('download').style.display='block'">
|
| 146 |
<i class=""></i> Find Out More! π¬
|
| 147 |
</button></a>
|
|
@@ -226,6 +223,8 @@ def block_users(client, threshold, dataset):
|
|
| 226 |
:return: The number of blocked users.
|
| 227 |
'''
|
| 228 |
num_users_blocked = 0
|
|
|
|
|
|
|
| 229 |
|
| 230 |
for filename in os.listdir("users"):
|
| 231 |
filename = os.path.join("users", filename)
|
|
@@ -401,7 +400,7 @@ with block:
|
|
| 401 |
value=auth_button_text.format(
|
| 402 |
get_target_website())).style(
|
| 403 |
)
|
| 404 |
-
gr.Dropdown(choices=list_of_servers, label="Server")
|
| 405 |
with gr.Row().style(equal_height=True):
|
| 406 |
radio = gr.CheckboxGroup(value=["Violent", "Hate Speech"],
|
| 407 |
choices=["Violent", "Hate Speech", "Misinformation"],
|
|
|
|
| 23 |
"mastodon.pirateparty.be",
|
| 24 |
"socel.net",
|
| 25 |
"mastodon.nz",
|
|
|
|
| 26 |
"noc.social",
|
| 27 |
"seo.chat",
|
| 28 |
"ioc.exchange",
|
|
|
|
| 90 |
:param mastodon: A admin masterdon instance.
|
| 91 |
:return: The target URL.
|
| 92 |
'''
|
| 93 |
+
return mastodon.auth_request_url(client_id="ivory-secret.txt", scopes=["write:blocks", "write:mutes"])
|
|
|
|
|
|
|
| 94 |
|
| 95 |
def login_from_code(code):
|
| 96 |
'''
|
|
|
|
| 138 |
<div class="w3-col">
|
| 139 |
<h1 class="w3-jumbo"><b>WatchTower ππ§</b></h1>
|
| 140 |
<h1 class="w3-xxxlarge w3-text-purple"><b>Remove Unfavorable Messages From Your Mastodon Feed </b></h1>
|
| 141 |
+
<p><span class="w3-xlarge">Scroll down to use WatchTower Ivory. β¬ </span> WatchTower is a tool that identifies hate speech, misinformation, and extremist content and blocks/ mutes it from your feed. WatchTower Ivory is the second iteration of WatchTower, designed specifically for Mastodon. WatchTower blocks content based on it's current database, so make sure to come back regularly to ensure you're up to date! We use a queue system, which means <b>you may need to wait your turn to run WatchTower</b> - however, once you've clicked run, you can close the tab as WatchTower will continue in the background. WatchTower is simple to use: first scroll down the page and click the Mastodon logo below, then you'll be taken to the Mastodon website and asked to verify yourself, after this you'll be taken back here, then simply scroll down to the bottom of the page and click run!</p>
|
| 142 |
<a href="https://www.watchtower.cartographer.one/"><button class="w3-button w3-light-grey w3-padding-large w3-section " onclick="document.getElementById('download').style.display='block'">
|
| 143 |
<i class=""></i> Find Out More! π¬
|
| 144 |
</button></a>
|
|
|
|
| 223 |
:return: The number of blocked users.
|
| 224 |
'''
|
| 225 |
num_users_blocked = 0
|
| 226 |
+
|
| 227 |
+
print("Testing dropdown value {}".format(dropdown.value))
|
| 228 |
|
| 229 |
for filename in os.listdir("users"):
|
| 230 |
filename = os.path.join("users", filename)
|
|
|
|
| 400 |
value=auth_button_text.format(
|
| 401 |
get_target_website())).style(
|
| 402 |
)
|
| 403 |
+
dropdown = gr.Dropdown(choices=list_of_servers, label="Server")
|
| 404 |
with gr.Row().style(equal_height=True):
|
| 405 |
radio = gr.CheckboxGroup(value=["Violent", "Hate Speech"],
|
| 406 |
choices=["Violent", "Hate Speech", "Misinformation"],
|