iCoderX commited on
Commit
59714eb
·
verified ·
1 Parent(s): ee96869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -4
app.py CHANGED
@@ -1,7 +1,22 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return f"Hello {name}!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()