Teotonix commited on
Commit
5cd7872
·
verified ·
1 Parent(s): 4dc9ea5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -7,22 +7,18 @@ def chat_fn(message, history):
7
  if history is None:
8
  history = []
9
 
10
- reply = f"Test cevap: {message}"
 
 
 
11
 
12
- history.append((message, reply))
13
- return history, ""
14
-
15
- payload = {
16
- "model": "mistral",
17
- "prompt": message,
18
- "stream": False
19
- }
20
 
21
- r = requests.post(OLLAMA_URL, json=payload, timeout=60)
22
- reply = r.json()["response"]
23
 
24
- history.append((message, reply))
25
- return history, ""
26
 
27
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
28
  # LOGO
@@ -43,6 +39,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
43
  inputs=[msg, chatbot],
44
  outputs=[chatbot, msg]
45
  )
 
 
 
 
46
 
47
  demo.launch(
48
  server_name="0.0.0.0",
 
7
  if history is None:
8
  history = []
9
 
10
+ history.append({
11
+ "role": "user",
12
+ "content": message
13
+ })
14
 
15
+ history.append({
16
+ "role": "assistant",
17
+ "content": f"Test cevap: {message}"
18
+ })
 
 
 
 
19
 
20
+ return history
 
21
 
 
 
22
 
23
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
24
  # LOGO
 
39
  inputs=[msg, chatbot],
40
  outputs=[chatbot, msg]
41
  )
42
+ chatbot = gr.Chatbot(
43
+ label="Maind.ai",
44
+ type="messages"
45
+ )
46
 
47
  demo.launch(
48
  server_name="0.0.0.0",