Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -548,6 +548,8 @@ import numpy as np
|
|
| 548 |
import re
|
| 549 |
import matplotlib.pyplot as plt
|
| 550 |
import pandas as pd
|
|
|
|
|
|
|
| 551 |
|
| 552 |
# Load main lightweight model (PyTorch based)
|
| 553 |
main_model_name = "distilbert-base-uncased-finetuned-sst-2-english"
|
|
@@ -561,6 +563,7 @@ fallback_model_name = "cardiffnlp/twitter-roberta-base-sentiment"
|
|
| 561 |
fallback_tokenizer = AutoTokenizer.from_pretrained(fallback_model_name)
|
| 562 |
fallback_model = AutoModelForSequenceClassification.from_pretrained(fallback_model_name).to(device)
|
| 563 |
|
|
|
|
| 564 |
# Reddit API setup
|
| 565 |
reddit = praw.Reddit(
|
| 566 |
client_id=os.getenv("REDDIT_CLIENT_ID"),
|
|
|
|
| 548 |
import re
|
| 549 |
import matplotlib.pyplot as plt
|
| 550 |
import pandas as pd
|
| 551 |
+
# Install tesseract OCR (only runs once in Hugging Face Spaces)
|
| 552 |
+
os.system("apt-get update && apt-get install -y tesseract-ocr")
|
| 553 |
|
| 554 |
# Load main lightweight model (PyTorch based)
|
| 555 |
main_model_name = "distilbert-base-uncased-finetuned-sst-2-english"
|
|
|
|
| 563 |
fallback_tokenizer = AutoTokenizer.from_pretrained(fallback_model_name)
|
| 564 |
fallback_model = AutoModelForSequenceClassification.from_pretrained(fallback_model_name).to(device)
|
| 565 |
|
| 566 |
+
|
| 567 |
# Reddit API setup
|
| 568 |
reddit = praw.Reddit(
|
| 569 |
client_id=os.getenv("REDDIT_CLIENT_ID"),
|