Spaces:
Sleeping
Sleeping
File size: 1,986 Bytes
4e80be3 7c21061 5e40307 7c21061 | 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 66 67 68 69 70 71 | ---
title: Trace Visualizer
emoji: π’
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 6.5.1
app_file: app.py
pinned: false
---
# Trace Model Visualizer
Gradio app for visualizing trace/trajectory predictions from [mihirgrao/trace-model](https://huggingface.co/mihirgrao/trace-model).
## Features
- **Image input**: Upload an image
- **Trace prediction**: Model predicts trajectory points from the image
- **Visual overlay**: Trace is overlaid on the image with gradient coloring (green start β red end)
- **Coordinate output**: Predicted trace points are printed below
## Installation
```bash
pip install -r requirements.txt
```
## Usage
### Gradio app
```bash
python app.py
```
Then open the URL (default: http://localhost:7860).
1. Click **Load Model** to load the trace model (first run downloads from Hugging Face)
2. Upload an image and optionally enter a task instruction (e.g. "Pick up the red block")
3. Click **Run Inference**
4. View the overlay image and predicted trace points
### Eval server
Run a FastAPI server for batch evaluation (e.g. from scripts or the Gradio app):
```bash
python eval_server.py --model-id mihirgrao/trace-model --port 8001
```
Endpoints:
- `POST /predict` β single image + instruction
- `POST /predict_batch` β batch of `{image_path?|image_base64?, instruction}` samples
- `GET /health`, `GET /model_info`
### CLI script
```bash
python predict_trace.py image.png
python predict_trace.py image.png -i "Pick up the red block"
python predict_trace.py image.png -o output_trace.png -i "Stack the cube on the block"
python predict_trace.py image.png -o output.png -m mihirgrao/trace-model
```
- `image` β Path to input image
- `-i, --instruction` β Task / language instruction (e.g. "Pick up the red block")
- `-o, --output` β Where to save the overlay (default: `<image>_trace.png`)
- `-m, --model-id` β Model ID (default: mihirgrao/trace-model)
- `-p, --prompt` β Full prompt override (if set, ignores `-i`)
|