my-bot-ai / app.py
Ruby-chan's picture
Update app.py
a08117d verified
Raw History Blame Contribute Delete
450 Bytes
import gradio as gr
from transformers import pipeline
generator = pipeline("text-generation", model="distilgpt2")
def chat(message):
result = generator(message, max_length=200, do_sample=True)
return result[0]['generated_text']
iface = gr.Interface(
fn=chat,
inputs="text",
outputs="text",
title="AI Bot",
description="Gửi câu hỏi, nhận câu trả lời từ AI."
)
if __name__ == "__main__":
iface.launch()