Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ from dotenv import load_dotenv
|
|
| 7 |
# Load environment variables
|
| 8 |
load_dotenv()
|
| 9 |
API_KEY = os.getenv("API_KEY")
|
|
|
|
| 10 |
HF_MODEL_URL = "https://api-inference.huggingface.co/models/tabularisai/multilingual-sentiment-analysis"
|
| 11 |
|
| 12 |
|
|
@@ -20,7 +21,7 @@ def analyze_post_gradio(post: str):
|
|
| 20 |
cleaned_post = clean_text(post)
|
| 21 |
|
| 22 |
# Get sentiment analysis
|
| 23 |
-
sentiment_result = query_hf_sentiment(cleaned_post,
|
| 24 |
|
| 25 |
# Handle possible formats of HF output
|
| 26 |
if isinstance(sentiment_result, dict) and "raw_output" in sentiment_result:
|
|
|
|
| 7 |
# Load environment variables
|
| 8 |
load_dotenv()
|
| 9 |
API_KEY = os.getenv("API_KEY")
|
| 10 |
+
brear_token=os.getenv("BEARER_TOKEN")
|
| 11 |
HF_MODEL_URL = "https://api-inference.huggingface.co/models/tabularisai/multilingual-sentiment-analysis"
|
| 12 |
|
| 13 |
|
|
|
|
| 21 |
cleaned_post = clean_text(post)
|
| 22 |
|
| 23 |
# Get sentiment analysis
|
| 24 |
+
sentiment_result = query_hf_sentiment(cleaned_post, brear_token, HF_MODEL_URL)
|
| 25 |
|
| 26 |
# Handle possible formats of HF output
|
| 27 |
if isinstance(sentiment_result, dict) and "raw_output" in sentiment_result:
|