Dyuti Dasmahapatra commited on
Commit
38107f5
Β·
1 Parent(s): a090f9b

docs: fix sample download paths; chore: Spaces-friendly Gradio launch (PORT, 0.0.0.0)

Browse files
Files changed (5) hide show
  1. CHEATSHEET.md +1 -1
  2. CODE_QUALITY.md +3 -3
  3. PROJECT_SUMMARY.md +2 -2
  4. README.md +5 -5
  5. app.py +5 -1
CHEATSHEET.md CHANGED
@@ -7,7 +7,7 @@
7
  python app.py
8
 
9
  # Download sample images
10
- python download_samples.py
11
 
12
  # Run tests
13
  pytest tests/ -v
 
7
  python app.py
8
 
9
  # Download sample images
10
+ python examples/download_samples.py
11
 
12
  # Run tests
13
  pytest tests/ -v
CODE_QUALITY.md CHANGED
@@ -205,7 +205,7 @@ License: MIT
205
  - **Comments**: Present in HTML sections
206
  - **Length**: 800+ lines
207
 
208
- #### 7. `download_samples.py` βœ…
209
  - **Docstring**: Added at module level
210
  - **Formatting**: Black + isort applied
211
  - **Comments**: Added for clarity
@@ -397,7 +397,7 @@ def predict_image(image, model, processor, top_k=5):
397
 
398
  ### Black (Code Formatter)
399
  ```bash
400
- black src/ app.py download_samples.py --line-length 100
401
  ```
402
 
403
  **Configuration**:
@@ -407,7 +407,7 @@ black src/ app.py download_samples.py --line-length 100
407
 
408
  ### isort (Import Sorter)
409
  ```bash
410
- isort src/ app.py download_samples.py --profile black
411
  ```
412
 
413
  **Configuration**:
 
205
  - **Comments**: Present in HTML sections
206
  - **Length**: 800+ lines
207
 
208
+ #### 7. `examples/download_samples.py` βœ…
209
  - **Docstring**: Added at module level
210
  - **Formatting**: Black + isort applied
211
  - **Comments**: Added for clarity
 
397
 
398
  ### Black (Code Formatter)
399
  ```bash
400
+ black src/ app.py examples/download_samples.py --line-length 100
401
  ```
402
 
403
  **Configuration**:
 
407
 
408
  ### isort (Import Sorter)
409
  ```bash
410
+ isort src/ app.py examples/download_samples.py --profile black
411
  ```
412
 
413
  **Configuration**:
PROJECT_SUMMARY.md CHANGED
@@ -91,8 +91,8 @@ Each directory includes a README.md with:
91
  - Tips for best results
92
 
93
  ### πŸ”§ Download Scripts
94
- 1. **download_samples.py** (6KB) - Python script to download images
95
- 2. **download_samples.sh** (5.2KB) - Bash script alternative
96
 
97
  ---
98
 
 
91
  - Tips for best results
92
 
93
  ### πŸ”§ Download Scripts
94
+ 1. **examples/download_samples.py** (6KB) - Python script to download images
95
+ 2. **examples/download_samples.sh** (5.2KB) - Bash script alternative
96
 
97
  ---
98
 
README.md CHANGED
@@ -104,7 +104,7 @@ examples/
104
  └── general/ # 4 images - Miscellaneous testing
105
  ```
106
 
107
- **Quick Download**: Run `python download_samples.py` to get all test images instantly!
108
 
109
  See [examples/README.md](examples/README.md) for detailed image descriptions and testing guidelines.
110
 
@@ -240,11 +240,11 @@ pip install -r requirements.txt
240
 
241
  ```bash
242
  # Download 20 curated test images for all tabs
243
- python download_samples.py
244
 
245
  # Or use the bash script
246
- chmod +x download_samples.sh
247
- ./download_samples.sh
248
  ```
249
 
250
  This creates an `examples/` directory with images organized by tab.
@@ -277,7 +277,7 @@ ViT-XAI-Dashboard/
277
  β”œβ”€β”€ app.py # Main Gradio application
278
  β”œβ”€β”€ requirements.txt # Python dependencies
279
  β”œβ”€β”€ README.md # This file
280
- β”œβ”€β”€ download_samples.py # Script to download test images
281
  β”‚
282
  β”œβ”€β”€ src/
283
  β”‚ β”œβ”€β”€ __init__.py
 
104
  └── general/ # 4 images - Miscellaneous testing
105
  ```
106
 
107
+ **Quick Download**: Run `python examples/download_samples.py` to get all test images instantly!
108
 
109
  See [examples/README.md](examples/README.md) for detailed image descriptions and testing guidelines.
110
 
 
240
 
241
  ```bash
242
  # Download 20 curated test images for all tabs
243
+ python examples/download_samples.py
244
 
245
  # Or use the bash script
246
+ chmod +x examples/download_samples.sh
247
+ ./examples/download_samples.sh
248
  ```
249
 
250
  This creates an `examples/` directory with images organized by tab.
 
277
  β”œβ”€β”€ app.py # Main Gradio application
278
  β”œβ”€β”€ requirements.txt # Python dependencies
279
  β”œβ”€β”€ README.md # This file
280
+ β”œβ”€β”€ examples/download_samples.py # Script to download test images
281
  β”‚
282
  β”œβ”€β”€ src/
283
  β”‚ β”œβ”€β”€ __init__.py
app.py CHANGED
@@ -830,4 +830,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="ViT Auditing Toolk
830
 
831
  # Launch the application
832
  if __name__ == "__main__":
833
- demo.launch(server_name="localhost", server_port=7860, share=False, show_error=True)
 
 
 
 
 
830
 
831
  # Launch the application
832
  if __name__ == "__main__":
833
+ import os as _os
834
+ # Use dynamic host/port for portability (e.g., Hugging Face Spaces)
835
+ host = "0.0.0.0"
836
+ port = int(_os.environ.get("PORT", "7860"))
837
+ demo.launch(server_name=host, server_port=port, share=False, show_error=True)