| import gradio as gr |
| from transformers import pipeline |
|
|
| |
| model_name = "TDN-M/tknv1" |
| pipe = pipeline("text-generation", model=model_name, max_new_tokens=512) |
|
|
| def chatbot(message, history): |
| |
| messages = [{"role": "user", "content": message}] |
| |
| |
| response = pipe(messages) |
| |
| |
| return response[0]['generated_text'] |
|
|
| |
| iface = gr.ChatInterface( |
| fn=chatbot, |
| title="Chatbot sử dụng tiếng Việt", |
| description="Một chatbot sử dụng mô hình đã được huấn luyện bằng tiếng Việt.", |
| theme="default", |
| css=".gradio-container {background-color: #fef0f0;}" |
| ) |
|
|
| |
| iface.launch(share=True) |