Spaces:
Sleeping
Sleeping
metadata
title: LineChatbot
emoji: π¬
colorFrom: pink
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
LineChatbot
A Streamlit chat app that role-plays a conversation partner using the Claude API, with optional persona/relationship analysis from an uploaded LINE chat export.
This README's YAML header configures it as a Docker Hugging Face Space.
How access works
- Passkey gate β if the
APP_PASSKEYsecret is set, visitors must enter it to use the app. Share the passkey with whoever you want to let in. - API key β if the
ANTHROPIC_API_KEYsecret is set, everyone who passes the passkey gate uses your key automatically. If it is not set, each visitor is asked to paste their own Anthropic key (kept only in their session, never saved). - Per-user isolation β every browser session gets its own data directory, so visitors never see or overwrite each other's conversations.
Deploy to Hugging Face Spaces
- Create a Space: https://huggingface.co/new-space β SDK: Docker β blank.
- Push this folder (
romance-chatbot/) as the Space repo root. The 1.1 GBmodel.ptcheckpoint must go through Git LFS (.gitattributesalready tracks*.pt):cd LineChatbot git init git lfs install git remote add origin https://huggingface.co/spaces/<you>/<space-name> git add . git commit -m "Deploy LineChatbot" git push origin main - In the Space: Settings β Variables and secrets, add:
APP_PASSKEY= the shared passkey you'll hand out (recommended).ANTHROPIC_API_KEY= your Claude key (optional β omit to make each visitor supply their own).CHAT_MODEL(optional, defaultclaude-haiku-4-5).
- The Space builds the Docker image and gives you a shareable URL. First use of the persona analysis / summarizer downloads the local models (a few GB) once.
Free CPU hardware works but the local models are slow on first use. Personality/ emotion analysis runs once at setup; summarization runs every 20 messages.
Run locally
cd romance-chatbot
pip install -r requirements.txt # torch CPU/GPU per your platform
export ANTHROPIC_API_KEY=sk-ant-... # or paste it in the UI
# export APP_PASSKEY=letmein # optional gate
streamlit run core/app.py
Configuration (env vars / Space secrets)
| Variable | Required | Purpose |
|---|---|---|
APP_PASSKEY |
no | Shared passkey gate. Unset = no gate. |
ANTHROPIC_API_KEY |
no | Server-side Claude key. Unset = visitors paste their own. |
CHAT_MODEL |
no | Claude model id (default claude-haiku-4-5). |
MAX_OUTPUT_TOKENS |
no | Max reply length (default 256). |