File size: 738 Bytes
1249a16
6892815
8b231ce
6892815
8b231ce
1249a16
 
 
6892815
1249a16
8b231ce
 
 
 
 
 
6892815
1249a16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from transformers import pipeline, Conversation

chatbot = pipeline("conversational", model="microsoft/DialoGPT-small")

def chat_fn(message, history=[]):
    conversation = Conversation(message)
    response = chatbot(conversation)
    return response.generated_responses[-1]

import gradio as gr
iface = gr.ChatInterface(
    chat_fn,
    title="Чат-помощник для детей",
    description="Я помогу тебе с вопросами, поддержу и объясню сложные вещи простыми словами.",
    examples=["Что делать, если я устал?", "Объясни задачу по математике простыми словами."],
    theme="soft"
)
iface.launch()