Saurabh Kumar commited on
Commit
0854641
·
verified ·
1 Parent(s): 150e47b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,11 +7,11 @@ from PIL import Image
7
  # Default: Load the model on the available device(s)
8
  @st.cache_resource
9
  def init_qwen_model():
10
- _model = Qwen2VLForConditionalGeneration.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto")
11
- _processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
12
- return _model, _processor
13
 
14
- def get_qwen_text(uploaded_file):
15
  if uploaded_file is not None:
16
  # Open the uploaded image file
17
  image = Image.open(uploaded_file)
 
7
  # Default: Load the model on the available device(s)
8
  @st.cache_resource
9
  def init_qwen_model():
10
+ model = Qwen2VLForConditionalGeneration.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto")
11
+ processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
12
+ return model, processor
13
 
14
+ def get_qwen_text(uploaded_file, model, processor):
15
  if uploaded_file is not None:
16
  # Open the uploaded image file
17
  image = Image.open(uploaded_file)