yuhos16 commited on
Commit
a760903
·
verified ·
1 Parent(s): 5cf4b1c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -3
README.md CHANGED
@@ -1,3 +1,106 @@
1
- ---
2
- license: cc-by-nc-sa-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ language:
4
+ - zh
5
+ - en
6
+ base_model:
7
+ - Qwen/Qwen2.5-VL-7B-Instruct
8
+ - Osilly/Vision-R1-7B
9
+ tags:
10
+ - medical
11
+ ---
12
+ ---
13
+
14
+ # SkinGPT-R1-test
15
+
16
+ **SkinGPT-R1** is a dermatological reasoning vision Language model (VLM).
17
+
18
+ ## ⚠️ Disclaimer
19
+
20
+ This model is **for research and educational use only**. It is **NOT a substitute for professional medical advice, diagnosis, or treatment**.
21
+
22
+ ## 🛠️ Environment Setup
23
+
24
+ To ensure compatibility, we strongly recommend creating a fresh Conda environment.
25
+
26
+ ### 1. Create Conda Environment
27
+
28
+ Create a new environment named skingpt-r1 with Python 3.10:
29
+
30
+ ```bash
31
+ conda create -n skingpt-r1 python=3.10 -y
32
+ conda activate skingpt-r1
33
+ ```
34
+
35
+ ### 2. Install Dependencies
36
+
37
+ ```bash
38
+ pip install -r requirements.txt
39
+ ```
40
+
41
+ ### (Optional) For faster inference on NVIDIA GPUs:
42
+
43
+ ```bash
44
+ pip install flash-attn --no-build-isolation
45
+ ```
46
+
47
+ ## 🚀 Usage
48
+
49
+ ### Quick Start
50
+
51
+ If you just installed the environment and want to check if it works:
52
+
53
+ Open ***demo.py*** and Change the ***IMAGE_PATH*** variable to your image file.
54
+
55
+ ```bash
56
+ python demo.py
57
+ ```
58
+
59
+ ### Interactive Chat
60
+
61
+ To have a multi-turn conversation (e.g., asking follow-up questions about the diagnosis) in your terminal:
62
+ ```bash
63
+ python chat.py --image ./test_images/lesion.jpg
64
+ ```
65
+ ### FastAPI Backend Deployment
66
+
67
+ To deploy the model as a backend service (supporting image uploads and session management):
68
+
69
+ #### Start the Server
70
+
71
+ ```bash
72
+ python app.py
73
+ ```
74
+ #### API Workflow
75
+ Manage sessions via state_id to support multi-user history.
76
+
77
+ Upload: POST /v1/upload/{state_id} — Uploads an image for the session.
78
+
79
+ Chat: POST /v1/predict/{state_id} — Sends text (JSON: {"message": "..."}) and gets a response.
80
+
81
+ Reset: POST /v1/reset/{state_id} — Clears session history and images.
82
+ #### Client Example
83
+ ```python
84
+ import requests
85
+
86
+ API_URL = "http://localhost:5900"
87
+ STATE_ID = "patient_001"
88
+
89
+ # 1. Upload Image
90
+ with open("skin_image.jpg", "rb") as f:
91
+ requests.post(f"{API_URL}/v1/upload/{STATE_ID}", files={"file": f})
92
+
93
+ # 2. Ask for Diagnosis
94
+ response = requests.post(
95
+ f"{API_URL}/v1/predict/{STATE_ID}",
96
+ json={"message": "Please analyze this image."}
97
+ )
98
+ print("AI:", response.json()["message"])
99
+
100
+ # 3. Ask Follow-up
101
+ response = requests.post(
102
+ f"{API_URL}/v1/predict/{STATE_ID}",
103
+ json={"message": "What treatment do you recommend?"}
104
+ )
105
+ print("AI:", response.json()["message"])
106
+ ```