Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from langdetect import detect
|
|
10 |
import asyncio # For asynchronous processing
|
11 |
|
12 |
# Initialize BLIP-2 model and processor for image-to-text
|
13 |
-
@st.
|
14 |
def load_blip2_model():
|
15 |
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
16 |
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b")
|
@@ -19,7 +19,7 @@ def load_blip2_model():
|
|
19 |
processor, model = load_blip2_model()
|
20 |
|
21 |
# Initialize translation pipeline for Korean to English
|
22 |
-
@st.
|
23 |
def load_translation_model():
|
24 |
return pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
25 |
|
|
|
10 |
import asyncio # For asynchronous processing
|
11 |
|
12 |
# Initialize BLIP-2 model and processor for image-to-text
|
13 |
+
@st.cache_resource # Use st.cache_resource for caching models
|
14 |
def load_blip2_model():
|
15 |
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
16 |
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b")
|
|
|
19 |
processor, model = load_blip2_model()
|
20 |
|
21 |
# Initialize translation pipeline for Korean to English
|
22 |
+
@st.cache_resource # Use st.cache_resource for caching models
|
23 |
def load_translation_model():
|
24 |
return pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
25 |
|