Spaces:
Runtime error
Runtime error
magnolia-pm
commited on
Commit
•
f1846be
1
Parent(s):
91f8342
added auth-token
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import torch
|
2 |
import streamlit as st
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
@@ -13,15 +14,19 @@ input_text = st.text_input(
|
|
13 |
#model_path = '/nlp/nlp/models/finetuned/twitter-xlm-roberta-base-regressive-desirability-ft-4'
|
14 |
model_path = 'magnolia-psychometrics/item-desirability'
|
15 |
|
|
|
|
|
16 |
tokenizer = AutoTokenizer.from_pretrained(
|
17 |
pretrained_model_name_or_path=model_path,
|
18 |
-
use_fast=True
|
|
|
19 |
)
|
20 |
|
21 |
model = AutoModelForSequenceClassification.from_pretrained(
|
22 |
pretrained_model_name_or_path=model_path,
|
23 |
num_labels=1,
|
24 |
ignore_mismatched_sizes=True,
|
|
|
25 |
)
|
26 |
|
27 |
def z_score(y, mean=.04853076, sd=.9409466):
|
|
|
1 |
+
import os
|
2 |
import torch
|
3 |
import streamlit as st
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
|
14 |
#model_path = '/nlp/nlp/models/finetuned/twitter-xlm-roberta-base-regressive-desirability-ft-4'
|
15 |
model_path = 'magnolia-psychometrics/item-desirability'
|
16 |
|
17 |
+
auth_token = os.environ.get("item-desirability") or True
|
18 |
+
|
19 |
tokenizer = AutoTokenizer.from_pretrained(
|
20 |
pretrained_model_name_or_path=model_path,
|
21 |
+
use_fast=True,
|
22 |
+
use_auth_token=auth_token
|
23 |
)
|
24 |
|
25 |
model = AutoModelForSequenceClassification.from_pretrained(
|
26 |
pretrained_model_name_or_path=model_path,
|
27 |
num_labels=1,
|
28 |
ignore_mismatched_sizes=True,
|
29 |
+
use_auth_token=auth_token
|
30 |
)
|
31 |
|
32 |
def z_score(y, mean=.04853076, sd=.9409466):
|