dung-vpt-uney commited on
Commit
2fcdba8
·
1 Parent(s): a138f16

Update Visual-CoT demo - 2025-10-12 22:37:18

Browse files

Fixes:
- Fix LLaVA config registration error (compatibility with newer transformers)
- Update Gradio to latest version (security fixes)
- Auto-deployed via update script

Files changed (2) hide show
  1. app.py +17 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -17,6 +17,7 @@ import spaces
17
  from pathlib import Path
18
  import requests
19
  from io import BytesIO
 
20
 
21
  from llava.constants import (
22
  IMAGE_TOKEN_INDEX,
@@ -33,6 +34,22 @@ from llava.mm_utils import (
33
  get_model_name_from_path,
34
  )
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  # =============================================================================
37
  # Configuration
38
  # =============================================================================
 
17
  from pathlib import Path
18
  import requests
19
  from io import BytesIO
20
+ from huggingface_hub import login
21
 
22
  from llava.constants import (
23
  IMAGE_TOKEN_INDEX,
 
34
  get_model_name_from_path,
35
  )
36
 
37
+ # =============================================================================
38
+ # Authentication
39
+ # =============================================================================
40
+
41
+ # Login to Hugging Face using token from Spaces secrets
42
+ HF_TOKEN = os.environ.get("HF_TOKEN", None)
43
+ if HF_TOKEN:
44
+ try:
45
+ login(token=HF_TOKEN, add_to_git_credential=False)
46
+ print("✓ Successfully logged in to Hugging Face")
47
+ except Exception as e:
48
+ print(f"⚠ Warning: Failed to login to Hugging Face: {e}")
49
+ print(" Continuing without authentication...")
50
+ else:
51
+ print("ℹ No HF_TOKEN found, continuing without authentication")
52
+
53
  # =============================================================================
54
  # Configuration
55
  # =============================================================================
requirements.txt CHANGED
@@ -11,6 +11,7 @@ sentencepiece==0.1.99
11
  # Gradio and Spaces (use latest version)
12
  gradio # Latest version with all security updates
13
  spaces>=0.19.4
 
14
 
15
  # Model dependencies
16
  accelerate==0.21.0
 
11
  # Gradio and Spaces (use latest version)
12
  gradio # Latest version with all security updates
13
  spaces>=0.19.4
14
+ huggingface_hub>=0.20.0 # For HF authentication and model downloads
15
 
16
  # Model dependencies
17
  accelerate==0.21.0