Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ from collections import defaultdict
|
|
| 17 |
from asyncpraw.models import MoreComments, Submission
|
| 18 |
from tqdm import tqdm
|
| 19 |
from huggingface_hub import InferenceClient, notebook_login
|
|
|
|
| 20 |
from datetime import datetime, timedelta
|
| 21 |
from datasets import load_dataset
|
| 22 |
from helper import get_access_to_reddit, get_write_access_to_hf, search_subreddits_by_keyword_in_name_or_description, filter_subreddits_by_keywords, get_subreddits_name_title_description, process_output, probe_subs_for_posts, default_dict_dict_dict_list, probe_submissions_for_comments, results_str_to_dict
|
|
@@ -68,7 +69,8 @@ async def main_async():
|
|
| 68 |
# -- pass new subreddits through classifier to determine if they are technology related --
|
| 69 |
print("passing new subreddits through classifier to determine if they are technology related...")
|
| 70 |
|
| 71 |
-
topic_classifier_client = InferenceClient(model="gulnuravci/subreddit_description_topic_classifier", token=os.getenv("REDDIT_READ"))
|
|
|
|
| 72 |
|
| 73 |
# key is the parent company and the value is a list of subreddit objects that are technology related
|
| 74 |
subreddits_passed_topic_classifier = defaultdict(list)
|
|
|
|
| 17 |
from asyncpraw.models import MoreComments, Submission
|
| 18 |
from tqdm import tqdm
|
| 19 |
from huggingface_hub import InferenceClient, notebook_login
|
| 20 |
+
from transformers import pipeline
|
| 21 |
from datetime import datetime, timedelta
|
| 22 |
from datasets import load_dataset
|
| 23 |
from helper import get_access_to_reddit, get_write_access_to_hf, search_subreddits_by_keyword_in_name_or_description, filter_subreddits_by_keywords, get_subreddits_name_title_description, process_output, probe_subs_for_posts, default_dict_dict_dict_list, probe_submissions_for_comments, results_str_to_dict
|
|
|
|
| 69 |
# -- pass new subreddits through classifier to determine if they are technology related --
|
| 70 |
print("passing new subreddits through classifier to determine if they are technology related...")
|
| 71 |
|
| 72 |
+
# topic_classifier_client = InferenceClient(model="gulnuravci/subreddit_description_topic_classifier", token=os.getenv("REDDIT_READ"))
|
| 73 |
+
topic_classifier_client = pipeline("text-classification", model="gulnuravci/subreddit_description_topic_classifier")
|
| 74 |
|
| 75 |
# key is the parent company and the value is a list of subreddit objects that are technology related
|
| 76 |
subreddits_passed_topic_classifier = defaultdict(list)
|