Spaces:
Runtime error
Runtime error
| 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() |