Trollsona / README.md
RthItalia's picture
Set pinned true with Codex
beab205 verified
|
Raw
History Blame Contribute Delete
6.02 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: Trollsona
emoji: 🧌
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 5.50.0
app_file: app.py
pinned: true

Trollsona / Your Troll Alterego

Tagline: Summon the little menace living behind your respectable personality.

Track: An Adventure in Thousand Token Wood

Build target: Hugging Face Space, Gradio app, small-model constraint <=32B.

GitHub repo: https://github.com/rthgit/Trollsona

Official Build Small Space: https://huggingface.co/spaces/build-small-hackathon/Trollsona

Backup Space: https://huggingface.co/spaces/RthItalia/Trollsona

Trollsona is a playful Gradio experience that turns a short user confession into a theatrical troll alter ego. The app returns a dossier-style result card with a trollsona name, a warm roast, one useful slap, and a goblin meter.

Built with a compact RthItalia model derived from Qwen/Qwen2.5-3B-Instruct, under 32B parameters. The deployed Space is configured to try that model first, then a lightweight Qwen 0.5B model, then the deterministic local fallback if model loading or generation is unavailable.

The official public Space currently runs the lightweight Qwen fallback on CPU, while the custom RthItalia compact 3B path is enabled automatically when CUDA is available.

Features

  • Immersive Gradio UI for Hugging Face Spaces
  • Theatrical trollsona result card
  • Local Hugging Face Transformers generation path for the primary AI runtime
  • Secondary lightweight Transformers model fallback
  • Deterministic fallback generator for final resilience
  • Safe roast guard for non-hateful, non-identity-targeted humor
  • Persona dropdown, sting slider, and useful-truth checkbox
  • Source/fallback notes hidden behind See the cursed paperwork

Model Runtime

Trollsona uses a small-model cascade:

  1. RthItalia/nano_compact_3b_qkvfp16

    • compact Qwen/Qwen2.5-3B-Instruct-derived model by RthItalia
    • preferred runtime when CUDA is available
    • loaded with trust_remote_code=True
  2. Qwen/Qwen2.5-0.5B-Instruct

    • lightweight hosted CPU fallback model
    • currently active on the official public Hugging Face Space running on cpu-basic
  3. Deterministic fallback

    • used only if both model paths are unavailable or return unsafe/invalid output
    • keeps the demo stable and reproducible

Constraint:

small model only, <=32B parameters

Space model-first behavior:

TROLLSONA_ENABLE_MODEL=1

Recommended Hugging Face Space variables:

TROLLSONA_ENABLE_MODEL=1
TROLLSONA_MODEL_ID=RthItalia/nano_compact_3b_qkvfp16
TROLLSONA_FALLBACK_MODEL_ID=Qwen/Qwen2.5-0.5B-Instruct
TROLLSONA_MAX_NEW_TOKENS=200

Local fallback-safe behavior if no variable is set:

TROLLSONA_ENABLE_MODEL=0

Deterministic fallback only:

TROLLSONA_ENABLE_MODEL=0

Implementation notes:

  • bitsandbytes is not required
  • primary RthItalia path expects CUDA
  • CPU-only Spaces use the Qwen 0.5B model before the deterministic fallback
  • source/runtime/fallback details are hidden in See the cursed paperwork

Stack

  • Python
  • Gradio
  • Hugging Face Spaces
  • Hugging Face Transformers, primary model path
  • PyTorch, model backend

Required secrets:

[ASSENTE]

Run Locally

pip install -r requirements.txt
python app.py

Open:

http://127.0.0.1:7860

Model-first run:

TROLLSONA_ENABLE_MODEL=1 python app.py

Deterministic fallback run:

TROLLSONA_ENABLE_MODEL=0 python app.py

Hugging Face Space

Required files:

  • app.py
  • requirements.txt
  • README.md
  • assets/style.css

Space SDK:

Gradio

Official Build Small Space URL:

https://huggingface.co/spaces/build-small-hackathon/Trollsona

Backup Space URL:

https://huggingface.co/spaces/RthItalia/Trollsona

Safety

Trollsona roasts habits, vibe, wording, overthinking, productivity rituals, internet behavior, startup energy, and harmless personal lore.

It avoids:

  • protected-class targeting
  • identity-based insults
  • appearance insults
  • threats or self-harm content
  • sexual content
  • profanity or slurs
  • cruelty or humiliation

If generated model output fails the safety guard, the app replaces it with a safe fallback card.

Hackathon Fit

  • Built as a Gradio app for Hugging Face Space
  • Fits An Adventure in Thousand Token Wood
  • Supports the <=32B small-model constraint
  • Uses RthItalia/nano_compact_3b_qkvfp16 as the primary AI path when CUDA is available
  • Keeps Qwen/Qwen2.5-0.5B-Instruct as a secondary model fallback
  • Runs without mandatory cloud APIs
  • Keeps deterministic fallback as a reliability guard
  • Produces short, whimsical, shareable output

Codex Track

Built with OpenAI Codex.

Public GitHub repo: https://github.com/rthgit/Trollsona

Codex-attributed commits include:

Known Limits