Spaces:
Sleeping
Sleeping
Nitzantry1
commited on
Commit
โข
840b854
1
Parent(s):
4cc2167
Update app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,12 @@ import gradio as gr
|
|
5 |
client = Client("dicta-il/dictalm2.0-instruct-demo")
|
6 |
|
7 |
def chat_with_model(history):
|
8 |
-
prompt = history[-1][
|
9 |
result = client.predict(
|
10 |
message=prompt,
|
11 |
api_name="/chat"
|
12 |
)
|
13 |
-
return history + [
|
14 |
|
15 |
# ืืฆืืจืช ืืืฉืง ืืชืงืื ืขื Gradio ืืฆืืจืช ืฆ'ื-ืืื
|
16 |
with gr.Blocks(theme="default") as demo:
|
@@ -21,8 +21,10 @@ with gr.Blocks(theme="default") as demo:
|
|
21 |
send_button = gr.Button("ืฉืื")
|
22 |
|
23 |
def user_chat(history, message):
|
24 |
-
return history + [
|
25 |
|
|
|
|
|
26 |
send_button.click(user_chat, inputs=[chatbot, user_input], outputs=[chatbot, user_input], queue=False)
|
27 |
send_button.click(chat_with_model, inputs=chatbot, outputs=chatbot)
|
28 |
|
|
|
5 |
client = Client("dicta-il/dictalm2.0-instruct-demo")
|
6 |
|
7 |
def chat_with_model(history):
|
8 |
+
prompt = history[-1][0]
|
9 |
result = client.predict(
|
10 |
message=prompt,
|
11 |
api_name="/chat"
|
12 |
)
|
13 |
+
return history + [(prompt, result)]
|
14 |
|
15 |
# ืืฆืืจืช ืืืฉืง ืืชืงืื ืขื Gradio ืืฆืืจืช ืฆ'ื-ืืื
|
16 |
with gr.Blocks(theme="default") as demo:
|
|
|
21 |
send_button = gr.Button("ืฉืื")
|
22 |
|
23 |
def user_chat(history, message):
|
24 |
+
return history + [(message, "")], ""
|
25 |
|
26 |
+
user_input.submit(user_chat, inputs=[chatbot, user_input], outputs=[chatbot, user_input], queue=False)
|
27 |
+
user_input.submit(chat_with_model, inputs=chatbot, outputs=chatbot)
|
28 |
send_button.click(user_chat, inputs=[chatbot, user_input], outputs=[chatbot, user_input], queue=False)
|
29 |
send_button.click(chat_with_model, inputs=chatbot, outputs=chatbot)
|
30 |
|