Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# تحميل نموذج محادثة (يمكنك تغيير اسم النموذج ليتناسب مع Lingbot-World)
|
| 5 |
+
chatbot_pipeline = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
| 6 |
|
| 7 |
+
def respond(message, history):
|
| 8 |
+
# دمج الرسالة الجديدة مع السياق
|
| 9 |
+
response = chatbot_pipeline(message)[0]['generated_text']
|
| 10 |
+
return response
|
| 11 |
+
|
| 12 |
+
# بناء واجهة Gradio
|
| 13 |
+
demo = gr.ChatInterface(
|
| 14 |
+
fn=respond,
|
| 15 |
+
title="Lingbot-World",
|
| 16 |
+
description="مرحباً بك في عالم Lingbot-World أونلاين!",
|
| 17 |
+
examples=["كيف حالك؟", "ما هو تخصصك؟"],
|
| 18 |
+
cache_examples=False,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
demo.launch()
|