Spaces:
Runtime error
Runtime error
ShreyMehra
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ st.markdown("Link to the model - [Image-to-Caption-App on 🤗 Spaces](https://h
|
|
14 |
#image uploader
|
15 |
image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
|
16 |
|
|
|
17 |
def load_model():
|
18 |
peft_model_id = "Shrey23/Image-Captioning"
|
19 |
config = PeftConfig.from_pretrained(peft_model_id)
|
@@ -24,11 +25,7 @@ def load_model():
|
|
24 |
return processor, model
|
25 |
|
26 |
|
27 |
-
|
28 |
-
processor, model = load_model() #load model
|
29 |
-
st.session_state.dict = {}
|
30 |
-
st.session_state.dict['processor'] = processor
|
31 |
-
st.session_state.dict['model'] = model
|
32 |
|
33 |
|
34 |
|
|
|
14 |
#image uploader
|
15 |
image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
|
16 |
|
17 |
+
@st.cache_data
|
18 |
def load_model():
|
19 |
peft_model_id = "Shrey23/Image-Captioning"
|
20 |
config = PeftConfig.from_pretrained(peft_model_id)
|
|
|
25 |
return processor, model
|
26 |
|
27 |
|
28 |
+
processor, model = load_model() #load model
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
|