vicgalle commited on
Commit
7f7b97d
1 Parent(s): 05dc25c

update app

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -5,15 +5,20 @@ from tqdm import tqdm
5
 
6
  st.title("Coffe machine captioning app")
7
 
8
- with st.spinner('Loading model and tokenizer...'):
 
 
9
 
10
- model_id = "Fer14/paligemma_coffe_machine_caption"
11
 
12
- model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)
13
- processor = PaliGemmaProcessor.from_pretrained(model_id)
14
 
15
- st.success('Model loaded!')
16
-
 
 
 
17
 
18
 
19
  # Instructions for Tesseract OCR
 
5
 
6
  st.title("Coffe machine captioning app")
7
 
8
+ @st.cache_resource()
9
+ def load_model():
10
+ with st.spinner('Loading model and tokenizer...'):
11
 
12
+ model_id = "Fer14/paligemma_coffe_machine_caption"
13
 
14
+ model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)
15
+ processor = PaliGemmaProcessor.from_pretrained(model_id)
16
 
17
+ st.success('Model loaded!')
18
+ return model, processor
19
+
20
+
21
+ model, processor = load_model()
22
 
23
 
24
  # Instructions for Tesseract OCR