CoolFace
Apppublic

softjapan/erika-demo

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes
App README

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 document

How It Works

  1. 1.A user message arrives through the Gradio ChatInterface in app.py.
  2. 2.The chat_fn coroutine rebuilds the conversation history in the Ollama chat format.
  3. 3.An AsyncClient instance sends the request to your Ollama server with the selected decoding parameters.
  4. 4.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.com
  • —OLLAMA_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 は以下の変数を参照して挙動を調整します。

変数名説明必須
OLLAMA_API_BASE_URLOllamaサーバーのURL (例: https://your-server.example.com)✅ 必須
OLLAMA_API_KEY認証用のAPIキー(Bearer token)任意
OLLAMA_MODEL_NAME使用するモデル名 (hf.co/softjapan/erika-ai-gguf:Q8_0)任意(デフォルト: hf.co/softjapan/erika-ai-gguf:Q8_0)
NUM_CTXコンテキスト長 (4096)任意
TEMPERATURE推論パラメータ (0.7)任意
REPEAT_PENALTY繰り返しペナルティ (1.0)任意
MIN_P最小確率 (0.001)任意
TOP_KTop K (64)任意
TOP_PTop P (0.9)任意
SYSTEM_PROMPTシステムプロンプト任意

エラーが発生した場合は UI 上部にメッセージが表示され、チャット UI が自動的に非表示になります。

ローカルでの実行

bash
export OLLAMA_API_BASE_URL=http://localhost:11434
export OLLAMA_MODEL_NAME="hf.co/softjapan/erika-ai-gguf:Q8_0"
python app.py

Ollamaサーバーがローカルで起動している必要があります。モデルは事前に ollama pull hf.co/softjapan/erika-ai-gguf:Q8_0 でダウンロードしておく必要があります。

Hugging Face Spaces へのデプロイ

  1. 1.新しい Space を作成し、このリポジトリのファイルをアップロードします。
  2. 2.Settings → Hardware で CPU Basic を選択します(Ollamaサーバーが別途必要)。
  3. 3.Settings → Secrets に以下の環境変数を設定します:
  4. 4.OLLAMA_API_BASE_URL: OllamaサーバーのURL
  5. 5.OLLAMA_API_KEY: APIキー(認証が必要な場合)
  6. 6.Settings → Variables にオプションの環境変数を設定します(上表参照)。
  7. 7.再ビルド後、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>