Update app.py with new chatbot code
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
-
#
|
5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
6 |
|
7 |
def respond(
|
@@ -23,6 +23,7 @@ def respond(
|
|
23 |
messages.append({"role": "user", "content": message})
|
24 |
|
25 |
response = ""
|
|
|
26 |
for message in client.chat_completion(
|
27 |
messages,
|
28 |
max_tokens=max_tokens,
|
@@ -34,7 +35,6 @@ def respond(
|
|
34 |
response += token
|
35 |
yield response
|
36 |
|
37 |
-
# إنشاء واجهة Gradio للشات بوت
|
38 |
demo = gr.ChatInterface(
|
39 |
respond,
|
40 |
additional_inputs=[
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
+
# استبدل "HuggingFaceH4/zephyr-7b-beta" بالموديل اللي تحب تستخدمه إذا أردت
|
5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
6 |
|
7 |
def respond(
|
|
|
23 |
messages.append({"role": "user", "content": message})
|
24 |
|
25 |
response = ""
|
26 |
+
|
27 |
for message in client.chat_completion(
|
28 |
messages,
|
29 |
max_tokens=max_tokens,
|
|
|
35 |
response += token
|
36 |
yield response
|
37 |
|
|
|
38 |
demo = gr.ChatInterface(
|
39 |
respond,
|
40 |
additional_inputs=[
|