Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines10111213141516171819202122232425269 unmodified linesif history :messages.extend(history)messages.append({"role":"user","content": message})response = client.chat_completion(messages, max_tokens = 400, temperature = 2, top_p =.999)return response["choices"][0]["message"]["content"].strip()def random_message (message, history):choices = ('yes','no','i dont think so','be so for real','yep', 'woooow', 'hmmmm', 'idk', 'idc', 'yaaay', 'why would i know')wow = random.choice(choices)theme = softreturn wowchatbot = gr.ChatInterface(respond, type = "messages", title = "chatty")9 unmodified lines1011121314151617181920212223242526272829303132333435363738399 unmodified linesif history :messages.extend(history)messages.append({"role":"user","content": message})response = ""for message in client.chat_completion(messages,max_tokens = 400,stream = True)token = message.choices[0].delta.contentresponse += tokenyield response# top_p & temperature#return response["choices"][0]["message"]["content"].strip()#def random_message (message, history):# choices = ('yes','no','i dont think so','be so for real','yep', 'woooow', 'hmmmm', 'idk', 'idc', 'yaaay', 'why would i know')# wow = random.choice(choices)# theme = soft# return wowchatbot = gr.ChatInterface(respond, type = "messages", title = "chatty")
app.py+20-7