softjapan/erika-demo
0
Erika-AI Demo (fine-tuned Erika model + Gradio)
日本語メイドカフェ風アシスタント「Erika AI (えりか)」のファインチューニング済みモデルを気軽に試せるデモです。やさしく褒めて励ます接客トーンに最適化され、軽量な GGUF 形式で CPU でも動かせるのが特徴です。モデルは softjapan/erika-ai-gguf で公開され、Apache-2.0 ライセンスのもと配布されています。
Key Features
- Maid-cafe tuned Japanese – polite・friendlyレスポンスに重点を置いた接客スタイル。
- 軽量 GGUF (Q8_0) – CPU でも動かせるため試しやすい。
- Streaming chat UI – トークン単位で表示し、レスポンスを体感しやすい。
- Live parameter controls –
num_ctx,temperature,repeat_penalty,min_p,top_k,top_pを UI から即時変更。 - Remote Ollama backend – あなたの Ollama 環境に接続するだけで利用可能。
- PWA ready – ブラウザからそのまま「アプリのように」使えます。
Erika AI は「ご主人さまをやさしく褒めて励ます」体験を重視した会話モデルです。出力される応答は常にポジティブで親しみやすいトーンを保ちます。
Repository Layout
.
├── app.py # Gradio application and Ollama integration
├── Dockerfile # Docker runtime definition for Hugging Face Spaces
├── requirements.txt # Minimal dependency list (gradio + ollama)
└── README.md # This documentHow It Works
- A user message arrives through the Gradio
ChatInterfaceinapp.py. - The
chat_fncoroutine rebuilds the conversation history in the Ollama chat format. - An
AsyncClientinstance sends the request to your Ollama server with the selected decoding parameters. - The streamed response is yielded back to the UI, updating the chat window in real time.
Prerequisites
- A reachable Ollama server with the Erika AI model pulled locally (e.g.,
ollama pull erika-ai). - Two environment variables configured as Hugging Face Secrets:
OLLAMA_API_BASE_URL– e.g.https://your-server.example.comOLLAMA_API_KEY– bearer token derived from your Ollama deployment (optional)- Python dependency versions resolved via
requirements.txt(handled automatically inside the Space Docker build).
環境変数
app.py は以下の変数を参照して挙動を調整します。
エラーが発生した場合は UI 上部にメッセージが表示され、チャット UI が自動的に非表示になります。
ローカルでの実行
export OLLAMA_API_BASE_URL=http://localhost:11434
export OLLAMA_MODEL_NAME="hf.co/softjapan/erika-ai-gguf:Q8_0"
python app.pyOllamaサーバーがローカルで起動している必要があります。モデルは事前に ollama pull hf.co/softjapan/erika-ai-gguf:Q8_0 でダウンロードしておく必要があります。
Hugging Face Spaces へのデプロイ
- 新しい Space を作成し、このリポジトリのファイルをアップロードします。
- Settings → Hardware で CPU Basic を選択します(Ollamaサーバーが別途必要)。
- Settings → Secrets に以下の環境変数を設定します:
OLLAMA_API_BASE_URL: OllamaサーバーのURLOLLAMA_API_KEY: APIキー(認証が必要な場合)- Settings → Variables にオプションの環境変数を設定します(上表参照)。
- 再ビルド後、Space が自動的に UI を立ち上げます。
注意事項:
- Ollamaサーバーは別途用意する必要があります。Space 自体は軽量なフロントエンドとして動作します。
- サーバー側でモデルを pull 済みであることが前提です。
Troubleshooting
- No response / timeouts – verify that the Space can reach your Ollama endpoint (firewall, TLS certs, etc.).
- 401 Unauthorized – regenerate the API key and re-enter the value in Hugging Face Secrets.
- Model errors – ensure the backend server has enough RAM/CPU and the requested model is downloaded.
安全性と制限事項
Erika AI はエンターテインメント用途を想定した会話モデルです。医療・法律・投資など専門的判断が必要なテーマに対しては、補助的なアドバイスのみを返し、最終判断は利用者に委ねられます。生成内容の正確性は保証されないため、重要な意思決定では必ず人間による確認を行ってください。
参考リンク
- モデルカード: softjapan/erika-ai-gguf
- Ollama Python SDK: <https://github.com/ollama/ollama-python>
- Ollama 公式サイト: <https://ollama.ai>
