File size: 696 Bytes
57a8496
1477b76
57a8496
1c37f2d
 
57a8496
7429dea
1c37f2d
 
 
 
7429dea
1c37f2d
 
 
 
 
 
57a8496
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()