Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines101112131314151617181920212223242526272816293031192021222332333435363738399 unmodified lines if history : messages.extend(history) messages.append({"role":"user","content": message}) response = client.chat_completion(messages, max_tokens = 400, temperature = 2, top_p =.999) response = ""
for message in client.chat_completion( messages, max_tokens = 400, stream = True) token = message.choices[0].delta.content response += token yield response
# top_p & temperature
return response["choices"][0]["message"]["content"].strip()#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 wow#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 wow
chatbot = gr.ChatInterface(respond, type = "messages", title = "chatty")app.py+20-7