Spaces:
Running
Running
Saurabh Kumar
commited on
Update app.py
Browse files
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 |
-
|
11 |
-
|
12 |
-
return
|
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)
|