LLDDWW Claude commited on
Commit
f89c606
·
1 Parent(s): 7d833fa

chore: upgrade to MedGemma-4B-IT for medical analysis

Browse files

- Add HF_TOKEN authentication for gated model access
- Use Google MedGemma-4B-IT (medical specialist model)
- Add huggingface_hub dependency for authentication
- Instructions for setting HF_TOKEN in Spaces secrets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +10 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import json
2
  import re
3
  from typing import List, Optional, Tuple
4
  import numpy as np
 
5
 
6
  import gradio as gr
7
  import spaces
@@ -9,6 +10,12 @@ import torch
9
  from PIL import Image
10
  from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor, AutoTokenizer, AutoModelForCausalLM
11
  from qwen_vl_utils import process_vision_info
 
 
 
 
 
 
12
 
13
  # OCR 모델 ID
14
  OCR_MODEL_ID = "Qwen/Qwen2.5-VL-7B-Instruct"
@@ -371,6 +378,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CUSTOM_CSS) as demo:
371
  **🤖 기술 스택**
372
  - Qwen2.5-VL-7B-Instruct (OCR 텍스트 추출)
373
  - Google MedGemma-4B-IT (의료 전문 모델 - 약 정보 분석 및 설명)
 
 
 
374
  """)
375
 
376
  if __name__ == "__main__":
 
2
  import re
3
  from typing import List, Optional, Tuple
4
  import numpy as np
5
+ import os
6
 
7
  import gradio as gr
8
  import spaces
 
10
  from PIL import Image
11
  from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor, AutoTokenizer, AutoModelForCausalLM
12
  from qwen_vl_utils import process_vision_info
13
+ from huggingface_hub import login
14
+
15
+ # Hugging Face 토큰으로 로그인 (Spaces Secret에서 가져옴)
16
+ HF_TOKEN = os.getenv("HF_TOKEN")
17
+ if HF_TOKEN:
18
+ login(token=HF_TOKEN)
19
 
20
  # OCR 모델 ID
21
  OCR_MODEL_ID = "Qwen/Qwen2.5-VL-7B-Instruct"
 
378
  **🤖 기술 스택**
379
  - Qwen2.5-VL-7B-Instruct (OCR 텍스트 추출)
380
  - Google MedGemma-4B-IT (의료 전문 모델 - 약 정보 분석 및 설명)
381
+
382
+ **🔑 설정 방법**
383
+ - Hugging Face Spaces의 Settings → Repository secrets에서 `HF_TOKEN` 추가 필요
384
  """)
385
 
386
  if __name__ == "__main__":
requirements.txt CHANGED
@@ -6,3 +6,4 @@ Pillow
6
  numpy
7
  qwen-vl-utils
8
  accelerate
 
 
6
  numpy
7
  qwen-vl-utils
8
  accelerate
9
+ huggingface_hub