Spaces:
Running
Running
A newer version of the Gradio SDK is available: 6.11.0
metadata
title: Prompt Squirrel
colorFrom: gray
colorTo: gray
sdk: gradio
sdk_version: 5.43.1
python_version: 3.10.12
app_file: app.py
pinned: false
license: apache-2.0
Prompt Squirrel RAG
Prompt Squirrel converts rough natural-language image descriptions into a structured, editable prompt built from a fixed image-tag vocabulary.
The intent is practical: produce a strong starting prompt quickly, then let users directly refine tag choices in the UI.
What This Space Does
- Rewrites free text into retrieval-friendly pseudo-tags.
- Retrieves candidate tags from a fixed vocabulary.
- Uses closed-set LLM selection (index-only) so models cannot invent arbitrary tags.
- Expands implications and groups tags into ranked editable rows.
- Builds the final suggested prompt from current toggle states.
How To Use
- Enter an image description in
Enter Prompt. - Click
Run. - Toggle tags in rows to add/remove them.
- Copy the final text from
Suggested Prompt.
Technologies Used
- FastText embeddings for semantic retrieval.
- HNSW indexes for efficient nearest-neighbor search.
- Reduced TF-IDF vectors for context-aware ranking.
- OpenRouter instruction models for rewrite, structural inference, probe inference, and closed-set selection.
Default model:
mistralai/mistral-small-24b-instruct-2501(chosen empirically on internal caption-evident evaluations; configurable). - Gradio for the interactive web UI.
Current Snapshot
Latest relabel-aware rescore on caption-evident n=30:
- Micro precision/recall/F1:
0.554 / 0.750 / 0.638 - Macro precision/recall/F1:
0.564 / 0.764 / 0.633 - Ground-truth scale: 30 images, 440 total tag assignments, 205 unique tags
Latency from local UI timing logs (n=110 runs):
- Median:
8.56s - P75:
12.56s - P90:
18.33s
Documentation And Contracts
- Full architecture and rationale (same source used by the in-app docs accordion): docs/space_overview.md
- Retrieval contract: docs/retrieval_contract.md
- Rewrite contract: docs/rewrite_contract.md
- Closed-set selection contract: docs/stage3_contract.md