bareethul commited on
Commit
a2c1d64
·
verified ·
1 Parent(s): 9482d82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -14,6 +14,7 @@ repo_dir = snapshot_download(repo_id=MODEL_REPO_ID)
14
 
15
  # Load predictor directly
16
  PREDICTOR = MultiModalPredictor.load(repo_dir)
 
17
 
18
  # Explicit class labels
19
  CLASS_LABELS = {0: "🚫 No Stop Sign", 1: "🛑 Stop Sign"}
@@ -24,9 +25,7 @@ def do_predict(pil_img: PIL.Image.Image):
24
  pil_resized = pil_img.convert("RGB").resize((256, 256))
25
 
26
  # Save to tmp for AutoGluon input
27
- tmpdir = pathlib.Path(tempfile.mkdtemp())
28
- img_path = tmpdir / "input.png"
29
- pil_img.save(img_path)
30
 
31
  df = pd.DataFrame({"image": [str(img_path)]})
32
 
 
14
 
15
  # Load predictor directly
16
  PREDICTOR = MultiModalPredictor.load(repo_dir)
17
+ TMP_PATH = pathlib.Path("tmp_input.png")
18
 
19
  # Explicit class labels
20
  CLASS_LABELS = {0: "🚫 No Stop Sign", 1: "🛑 Stop Sign"}
 
25
  pil_resized = pil_img.convert("RGB").resize((256, 256))
26
 
27
  # Save to tmp for AutoGluon input
28
+ pil_resized.save(TMP_PATH)
 
 
29
 
30
  df = pd.DataFrame({"image": [str(img_path)]})
31