datdevsteve commited on
Commit
91d3362
·
verified ·
1 Parent(s): c3d15cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -25
app.py CHANGED
@@ -34,31 +34,8 @@ def chat_fn(message, history):
34
  # 🆕 VISION ENDPOINT (FILE-BASED, NO BASE64)
35
  # ==================================================
36
 
37
- def vision_fn(image: Image.Image, hint_text: str):
38
- """
39
- image: PIL Image (uploaded by Gradio)
40
- hint_text: optional user context
41
- """
42
-
43
- if image is None:
44
- return (
45
- "[PRIMARY DIAGNOSIS] Inconclusive [/PRIMARY DIAGNOSIS]\n"
46
- "[DIAGNOSIS DESCRIPTION] No image provided. [/DIAGNOSIS DESCRIPTION]\n"
47
- "[FIRST AID] Please upload a valid image. [/FIRST AID]\n"
48
- "[EMERGENCY CONSULTATION REQUIRED] No [/EMERGENCY CONSULTATION REQUIRED]"
49
- )
50
-
51
- # Save image to HF-served temp directory
52
- filename = f"{uuid.uuid4()}.png"
53
- path = os.path.join(UPLOAD_DIR, filename)
54
- image.save(path)
55
-
56
- # HF Spaces automatically serve /file= paths
57
- image_url = f"{SPACE_HOST}/file={path}"
58
-
59
- print(f"📥 Vision image saved: {image_url}")
60
-
61
- # Pass URL to agent (CRITICAL FIX)
62
  return nivra_vision(image_url, hint_text)
63
 
64
  # ==================================================
 
34
  # 🆕 VISION ENDPOINT (FILE-BASED, NO BASE64)
35
  # ==================================================
36
 
37
+
38
+ def vision_fn(image_url: str, hint_text: str):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  return nivra_vision(image_url, hint_text)
40
 
41
  # ==================================================