reehandn commited on
Commit
8eeda40
Β·
verified Β·
1 Parent(s): 3d1fcc8

update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -14,10 +14,11 @@ app = FastAPI(title="IndoBERT Financial Sentiment API")
14
 
15
  # ─── Load model from HF repo ─────────────────────────────────────────────────
16
  MODEL_ID = os.getenv("MODEL_ID", "reehandn/model-financial-sentiment")
 
17
 
18
  print(f"[Init] Loading model: {MODEL_ID}")
19
- tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
20
- model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
21
  model.eval()
22
  print("[Init] Model loaded successfully!")
23
 
 
14
 
15
  # ─── Load model from HF repo ─────────────────────────────────────────────────
16
  MODEL_ID = os.getenv("MODEL_ID", "reehandn/model-financial-sentiment")
17
+ HF_TOKEN = os.getenv("HF_TOKEN", None) # Secret di Space settings
18
 
19
  print(f"[Init] Loading model: {MODEL_ID}")
20
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, token=HF_TOKEN)
21
+ model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID, token=HF_TOKEN)
22
  model.eval()
23
  print("[Init] Model loaded successfully!")
24