airzy1 commited on
Commit
da7b320
·
verified ·
1 Parent(s): 1cc39ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -12,7 +12,7 @@ from PIL import Image, ImageOps
12
  # Qwen3-VL requires the latest Transformers from source.
13
  # In your Space requirements, use:
14
  # pip install git+https://github.com/huggingface/transformers
15
- from transformers import AutoProcessor, Qwen3VLMoeForConditionalGeneration
16
 
17
  # ---------------------------
18
  # Environment / cache setup
@@ -33,7 +33,7 @@ torch.set_float32_matmul_precision("high")
33
  HF_TOKEN = os.environ.get("HF_TOKEN", "")
34
 
35
  # Qwen3-VL upgrade path
36
- MODEL_ID = "Qwen/Qwen3-VL-30B-A3B-Instruct" # "Qwen/Qwen3-VL-8B-Instruct"
37
 
38
  processor = None
39
  model = None
@@ -51,7 +51,7 @@ def load_model() -> None:
51
  )
52
 
53
  print("Loading model...")
54
- model = Qwen3VLMoeForConditionalGeneration.from_pretrained(
55
  MODEL_ID,
56
  token=HF_TOKEN if HF_TOKEN else None,
57
  device_map="auto",
@@ -91,7 +91,7 @@ def extract_json(text: str) -> Dict[str, Any]:
91
  return {"raw_output": text}
92
 
93
 
94
- PROMPT = "Analyze this pantry image in detail, list all ingredient as JSON"
95
 
96
 
97
 
 
12
  # Qwen3-VL requires the latest Transformers from source.
13
  # In your Space requirements, use:
14
  # pip install git+https://github.com/huggingface/transformers
15
+ from transformers import AutoProcessor, Qwen3VLForConditionalGeneration
16
 
17
  # ---------------------------
18
  # Environment / cache setup
 
33
  HF_TOKEN = os.environ.get("HF_TOKEN", "")
34
 
35
  # Qwen3-VL upgrade path
36
+ MODEL_ID = "Qwen/Qwen3-VL-8B-Instruct"
37
 
38
  processor = None
39
  model = None
 
51
  )
52
 
53
  print("Loading model...")
54
+ model = Qwen3VLForConditionalGeneration.from_pretrained(
55
  MODEL_ID,
56
  token=HF_TOKEN if HF_TOKEN else None,
57
  device_map="auto",
 
91
  return {"raw_output": text}
92
 
93
 
94
+ PROMPT = "Analyze this pantry image in detail, list all ingredient as short JSON list"
95
 
96
 
97