Flaretext2text / app.py
HaveAI's picture
Update app.py
1c37f2d verified
raw
history blame
696 Bytes
import gradio as gr
from transformers import pipeline
# Заменить модель на свою
pipe = pipeline("text-generation", model="название_твоей_модели")
def chat_fn(message, history):
# Получаем ответ от модели
output = pipe(message, max_new_tokens=200)[0]['generated_text']
# Можно очистить префикс, если он дублирует prompt
return output.strip()
gr.ChatInterface(
fn=chat_fn,
title="Flare Chat",
theme="soft", # Можно убрать или изменить
examples=["Привет!", "Расскажи шутку", "Кто такой Эйнштейн?"],
).launch()