tahirsher commited on
Commit
ec46535
·
verified ·
1 Parent(s): 22e7882

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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.cache(allow_output_mutation=True)
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.cache(allow_output_mutation=True)
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