Spaces:
Running
on
Zero
Running
on
Zero
metadata
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):
# 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):
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
- 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). - Push this repo (or the
gradio_spacefolder and a way to install the parent package). The Space’srequirements.txtwill runpip install -e .., so the full repo must be in the Space (clone the whole repo and set root togradio_space). - 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:
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)
"