Spaces:
Runtime error
Runtime error
add token as secret
Browse files
app.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
|
|
| 1 |
from transformers import DistilBertTokenizer
|
| 2 |
from transformers import DistilBertForSequenceClassification
|
| 3 |
from transformers import pipeline
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
MODEL_PATH = "xiaopeiwu/hrw_v2"
|
| 7 |
-
|
|
|
|
| 8 |
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
| 9 |
|
| 10 |
demo = gr.Interface(
|
|
|
|
| 1 |
+
import os
|
| 2 |
from transformers import DistilBertTokenizer
|
| 3 |
from transformers import DistilBertForSequenceClassification
|
| 4 |
from transformers import pipeline
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
MODEL_PATH = "xiaopeiwu/hrw_v2"
|
| 8 |
+
auth_token = os.environ.get("TOKEN_FROM_SECRET")
|
| 9 |
+
model = DistilBertForSequenceClassification.from_pretrained(MODEL_PATH, use_auth_token=auth_token)
|
| 10 |
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
| 11 |
|
| 12 |
demo = gr.Interface(
|