Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,143 Bytes
9873859 e058b41 390e628 9873859 53e63a7 9873859 4ed98e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
---
title: UnReflectAnything
emoji: 💻
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: 6.5.1
python_version: 3.12
app_file: app.py
pinned: false
license: mit
---
# UnReflectAnything – Gradio demo
Remove specular reflections from images using the UnReflectAnything model.
## Run locally
From the **repository root** (parent of `gradio_space`):
```bash
# 1. Install the project and Gradio
pip install -e .
pip install "gradio>=4.0"
# 2. Download weights (once)
unreflect download --weights
# 3. Run the Gradio app from the repo root so Python finds the package
cd gradio_space && python app.py
```
Then open the URL shown in the terminal (e.g. http://127.0.0.1:7860).
Alternatively, from `gradio_space` only (e.g. if the repo root is one level up):
```bash
cd gradio_space
pip install -r requirements.txt # installs gradio + parent package (-e ..)
python app.py
```
Weights are downloaded automatically on first run if missing.
## Run on Hugging Face Spaces
1. Create a new Space, choose **Gradio** SDK, and set the **Root directory** to `gradio_space` (so the Space uses this folder as the app root).
2. Push this repo (or the `gradio_space` folder and a way to install the parent package). The Space’s `requirements.txt` will run `pip install -e ..`, so the **full repo must be in the Space** (clone the whole repo and set root to `gradio_space`).
3. On first run, the app will download weights to the Space cache.
**To test the live Space:** open the Space URL (e.g. `https://huggingface.co/spaces/<your-username>/<space-name>`), upload an image, optionally adjust the brightness threshold, and click **Remove reflections**.
**API / headless test:** use the “View API” link at the bottom of the Space page to get the Gradio API URL (e.g. `https://<space-name>.hf.space`), then call the `/predict` endpoint with your image, or use the Gradio client:
```bash
pip install gradio_client
python -c "
from gradio_client import Client
client = Client('https://YOUR-USER-YOUR-SPACE.hf.space')
result = client.predict('path/to/image.png', 0.8, api_name='/predict') # adjust api_name if needed
print(result)
"
```
|