Saurabh Kumar commited on
Commit
7a40854
·
verified ·
1 Parent(s): ee30b6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -11,14 +11,13 @@ def init_qwen_model():
11
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
12
  return model, processor
13
 
 
14
  # Streamlit app title
15
  st.title("OCR Image Text Extraction")
16
 
17
  # File uploader for images
18
  uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
19
 
20
- MODEL, PROCESSOR = init_qwen_model()
21
-
22
  if uploaded_file is not None:
23
  # Open the uploaded image file
24
  image = Image.open(uploaded_file)
@@ -42,7 +41,7 @@ if uploaded_file is not None:
42
  messages, tokenize=False, add_generation_prompt=True
43
  )
44
  image_inputs, video_inputs = process_vision_info(messages)
45
- inputs = processor(
46
  text=[text],
47
  images=image_inputs,
48
  videos=video_inputs,
 
11
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
12
  return model, processor
13
 
14
+ MODEL, PROCESSOR = init_qwen_model()
15
  # Streamlit app title
16
  st.title("OCR Image Text Extraction")
17
 
18
  # File uploader for images
19
  uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
20
 
 
 
21
  if uploaded_file is not None:
22
  # Open the uploaded image file
23
  image = Image.open(uploaded_file)
 
41
  messages, tokenize=False, add_generation_prompt=True
42
  )
43
  image_inputs, video_inputs = process_vision_info(messages)
44
+ inputs = PROCESSOR(
45
  text=[text],
46
  images=image_inputs,
47
  videos=video_inputs,