socd06 commited on
Commit
30dfdfe
·
1 Parent(s): e49b823

call os.environ["SECRET_TOKEN"]

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,13 +1,15 @@
1
  import os
2
- from huggingface_hub import from_pretrained_fastai
 
3
 
4
  import gradio as gr
5
  from gradio.components import Image
6
  from gradio import Label
7
 
8
-
9
  SECRET_TOKEN = os.environ["SECRET_TOKEN"]
10
- learner = from_pretrained_fastai("artificeresearch/spiritvision")
 
 
11
  labels = learner.dls.vocab
12
 
13
 
@@ -23,4 +25,4 @@ def predict_fn(img):
23
  gr.Interface(predict_fn,
24
  Image(shape=(512, 512)),
25
  outputs=Label(num_top_classes=3),
26
- hf_token=SECRET_TOKEN).launch()
 
1
  import os
2
+ from huggingface_hub import hf_hub_download
3
+ from fastai.learner import load_learner
4
 
5
  import gradio as gr
6
  from gradio.components import Image
7
  from gradio import Label
8
 
 
9
  SECRET_TOKEN = os.environ["SECRET_TOKEN"]
10
+
11
+ # learner = from_pretrained_fastai("artificeresearch/spiritvision")
12
+ learner = load_learner(hf_hub_download("artificeresearch/spiritvision", "model.pkl", token=SECRET_TOKEN))
13
  labels = learner.dls.vocab
14
 
15
 
 
25
  gr.Interface(predict_fn,
26
  Image(shape=(512, 512)),
27
  outputs=Label(num_top_classes=3),
28
+ ).launch()