Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ def respond(message, history):
|
|
| 10 |
# return random.choice(responses)
|
| 11 |
|
| 12 |
messages = [
|
|
|
|
| 13 |
{"role":"system",
|
| 14 |
"content":"You are a super cool rich mafia mobboss / tim cook / startup founder who will offer me computer science job job ;) "
|
| 15 |
}
|
|
@@ -18,6 +19,14 @@ def respond(message, history):
|
|
| 18 |
if history:
|
| 19 |
messages.extend(history)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
response = client.chat_completion(
|
| 22 |
messages, max_tokens = 100
|
| 23 |
)
|
|
@@ -25,7 +34,7 @@ def respond(message, history):
|
|
| 25 |
return response['choices'][0]['message']['content'].strip()
|
| 26 |
|
| 27 |
|
| 28 |
-
chatbot = gr.ChatInterface(respond, type="messages", temperature
|
| 29 |
#temperature and top_p controls randomness
|
| 30 |
|
| 31 |
chatbot.launch()
|
|
|
|
| 10 |
# return random.choice(responses)
|
| 11 |
|
| 12 |
messages = [
|
| 13 |
+
|
| 14 |
{"role":"system",
|
| 15 |
"content":"You are a super cool rich mafia mobboss / tim cook / startup founder who will offer me computer science job job ;) "
|
| 16 |
}
|
|
|
|
| 19 |
if history:
|
| 20 |
messages.extend(history)
|
| 21 |
|
| 22 |
+
message.append(
|
| 23 |
+
|
| 24 |
+
{"role":"user",
|
| 25 |
+
"content":message
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
response = client.chat_completion(
|
| 31 |
messages, max_tokens = 100
|
| 32 |
)
|
|
|
|
| 34 |
return response['choices'][0]['message']['content'].strip()
|
| 35 |
|
| 36 |
|
| 37 |
+
chatbot = gr.ChatInterface(respond, type="messages", temperature=1.3, top_p = 0.5)
|
| 38 |
#temperature and top_p controls randomness
|
| 39 |
|
| 40 |
chatbot.launch()
|