boot.abbass / app.py
j2rajerz's picture
Create app.py
cb7c13e verified
raw
history blame contribute delete
640 Bytes
import gradio as gr
from transformers import pipeline
# بارگیری مدل فارسی (مثلاً mBERT یا پارسBERT)
chatbot = pipeline("text-generation", model="HooshvareLab/bert-fa-base-uncased")
def chat(message, history):
# تولید پاسخ با استفاده از مدل
response = chatbot(message, max_length=50)[0]['generated_text']
return response
# ایجاد رابط کاربری با Gradio
iface = gr.Interface(
fn=chat,
inputs="text",
outputs="text",
title="چت بات فارسی",
description="یک چت بات ساده با استفاده از Hugging Face"
)
iface.launch()