Nitzantry1 commited on
Commit
51eae2b
ยท
verified ยท
1 Parent(s): d8cb72d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -5,11 +5,14 @@ import gradio as gr
5
  client = Client("dicta-il/dictalm2.0-instruct-demo")
6
 
7
  def chat_with_model(history):
8
- # ืงื‘ืœืช ื”ื”ื•ื“ืขื” ื”ืื—ืจื•ื ื” ืฉื ืฉืœื—ื” ืขืœ ื™ื“ื™ ื”ืžืฉืชืžืฉ
9
  prompt = history[-1]["content"]
10
- # ืฉืœื™ื—ืช ื”ื”ื•ื“ืขื” ืœืžื•ื“ืœ ื•ืงื‘ืœืช ืชื’ื•ื‘ื”
11
- result = client.predict(message=prompt, api_name="/chat")
12
- return history + [{"role": "user", "content": prompt}, {"role": "bot", "content": result}]
 
 
 
13
 
14
  # ื™ืฆื™ืจืช ืžืžืฉืง ืžืชืงื“ื ืขื Gradio ื‘ืฆื•ืจืช ืฆ'ื˜-ื‘ื•ื˜ ื‘ืกื’ื ื•ืŸ ืืงื“ืžื™
15
  with gr.Blocks(theme="default") as demo:
@@ -25,7 +28,7 @@ with gr.Blocks(theme="default") as demo:
25
  send_button = gr.Button("ืฉืœื—")
26
 
27
  def user_chat(history, message):
28
- # ื”ื•ืกืคืช ื”ื•ื“ืขืช ื”ืžืฉืชืžืฉ ืœื”ื™ืกื˜ื•ืจื™ื” ืœืคื ื™ ืฉืœื™ื—ืช ื”ืฉืืœื” ืœืžื•ื“ืœ
29
  return history + [{"role": "user", "content": message}], ""
30
 
31
  # ืฉืœื™ื—ืช ื”ื”ื•ื“ืขื” ื’ื ื‘ืœื—ื™ืฆื” ืขืœ Enter ื•ื’ื ืขืœ ื™ื“ื™ ืœื—ื™ืฆื” ืขืœ ื›ืคืชื•ืจ "ืฉืœื—"
 
5
  client = Client("dicta-il/dictalm2.0-instruct-demo")
6
 
7
  def chat_with_model(history):
8
+ # ืงื‘ืœืช ื”ื”ื•ื“ืขื” ื”ืื—ืจื•ื ื” ืžื”ืžืฉืชืžืฉ
9
  prompt = history[-1]["content"]
10
+ # ืงืจื™ืื” ืœืžื•ื“ืœ ืœืงื‘ืœืช ืชื’ื•ื‘ื”
11
+ result = client.predict(
12
+ message=prompt
13
+ )
14
+ # ื”ื•ืกืคืช ื”ืชื’ื•ื‘ื” ืžื”ืžื•ื“ืœ ืœื”ื™ืกื˜ื•ืจื™ื”
15
+ return history + [{"role": "bot", "content": result}]
16
 
17
  # ื™ืฆื™ืจืช ืžืžืฉืง ืžืชืงื“ื ืขื Gradio ื‘ืฆื•ืจืช ืฆ'ื˜-ื‘ื•ื˜ ื‘ืกื’ื ื•ืŸ ืืงื“ืžื™
18
  with gr.Blocks(theme="default") as demo:
 
28
  send_button = gr.Button("ืฉืœื—")
29
 
30
  def user_chat(history, message):
31
+ # ื”ื•ืกืคืช ื”ื•ื“ืขืช ื”ืžืฉืชืžืฉ ืœื”ื™ืกื˜ื•ืจื™ื”
32
  return history + [{"role": "user", "content": message}], ""
33
 
34
  # ืฉืœื™ื—ืช ื”ื”ื•ื“ืขื” ื’ื ื‘ืœื—ื™ืฆื” ืขืœ Enter ื•ื’ื ืขืœ ื™ื“ื™ ืœื—ื™ืฆื” ืขืœ ื›ืคืชื•ืจ "ืฉืœื—"