Spaces:
Runtime error
Runtime error
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() | |