Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,14 @@ import streamlit as st
|
|
3 |
from transformers import TFAutoModelForImageClassification, AutoFeatureExtractor
|
4 |
from PIL import Image
|
5 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Load the model and feature extractor
|
8 |
model = TFAutoModelForImageClassification.from_pretrained(os.environ.get("MODEL_ID", "willco-afk/tree-test-x"))
|
|
|
3 |
from transformers import TFAutoModelForImageClassification, AutoFeatureExtractor
|
4 |
from PIL import Image
|
5 |
import numpy as np
|
6 |
+
from huggingface_hub import login
|
7 |
+
|
8 |
+
|
9 |
+
# Authenticate with Hugging Face token (if available)
|
10 |
+
hf_token = os.environ.get("HF_TOKEN")
|
11 |
+
if hf_token:
|
12 |
+
login(token=hf_token)
|
13 |
+
|
14 |
|
15 |
# Load the model and feature extractor
|
16 |
model = TFAutoModelForImageClassification.from_pretrained(os.environ.get("MODEL_ID", "willco-afk/tree-test-x"))
|