添加API_URL
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
| 3 |
import torch
|
| 4 |
import os
|
| 5 |
from transformers import AutoTokenizer, AutoModel
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Assuming you have set the HF_TOKEN environment variable with your Hugging Face token
|
| 8 |
huggingface_token = os.getenv('HF_TOKEN')
|
|
@@ -10,6 +12,8 @@ huggingface_token = os.getenv('HF_TOKEN')
|
|
| 10 |
# Set up the token to use with the Hugging Face API
|
| 11 |
if huggingface_token is not None:
|
| 12 |
os.environ['HUGGINGFACE_CO_API_TOKEN'] = huggingface_token
|
|
|
|
|
|
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained("Tokymin/Mood_Anxiety_Disorder_Classify_Model")
|
| 14 |
else:
|
| 15 |
print("error, no token")
|
|
|
|
| 3 |
import torch
|
| 4 |
import os
|
| 5 |
from transformers import AutoTokenizer, AutoModel
|
| 6 |
+
import requests
|
| 7 |
+
|
| 8 |
|
| 9 |
# Assuming you have set the HF_TOKEN environment variable with your Hugging Face token
|
| 10 |
huggingface_token = os.getenv('HF_TOKEN')
|
|
|
|
| 12 |
# Set up the token to use with the Hugging Face API
|
| 13 |
if huggingface_token is not None:
|
| 14 |
os.environ['HUGGINGFACE_CO_API_TOKEN'] = huggingface_token
|
| 15 |
+
API_URL = "https://api-inference.huggingface.co/models/Tokymin/Mood_Anxiety_Disorder_Classify_Model"
|
| 16 |
+
headers = {"Authorization": f"Tokymin {huggingface_token}"}
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("Tokymin/Mood_Anxiety_Disorder_Classify_Model")
|
| 18 |
else:
|
| 19 |
print("error, no token")
|