jsminenguyen commited on
Commit
f21101a
·
verified ·
1 Parent(s): 328eae1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -5,7 +5,14 @@ import torch
5
  import gradio as gr
6
  import random
7
 
8
-
 
 
 
 
 
 
 
9
 
10
  chat_theme = gr.themes.Soft(
11
  primary_hue="indigo",
 
5
  import gradio as gr
6
  import random
7
 
8
+ def respond(message, history):
9
+ messages = [{"role":"system", "content":"You are a friendly chatbot :)"}]
10
+ if history:
11
+ messages.extend(history)
12
+ messages.append({"role":"user", "content":message})
13
+ response = client.chat_completion(messages, max_tokens=100, temperature=1.3, top_p=0.2)
14
+ # temperature and top_p control randomness
15
+ return response["choices"][0]["message"]["content"].strip()
16
 
17
  chat_theme = gr.themes.Soft(
18
  primary_hue="indigo",