Test / app.py
keita-origin's picture
Update app.py
5cb0881 verified
raw
history blame
598 Bytes
import gradio as gr
from transformers import pipeline
# モデルの読み込み
generator = pipeline("text-generation", model="keita-origin/Da-1.1b")
# チャット履歴を保持する関数
def chatbot(message, history):
history.append((message, ""))
response = generator(message, max_length=100)[0]["generated_text"]
history[-1] = (message, response)
return history
# ChatGPT 風のインターフェース
chatbot_ui = gr.ChatInterface(
chatbot,
title="AI Chatbot",
description="Hugging Face のモデルを使った対話型 AI",
)
# 実行
chatbot_ui.launch()