Spaces:
Build error
Build error
Commit
•
6a8b202
1
Parent(s):
8d19ffb
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
"
|
9 |
"If you need more context, ask for it."
|
10 |
-
"Make sure you know the effective stack and whether it's a cash game or mtt. Ask for clarification if not it's not clear"
|
11 |
"Concentrate more on GTO play rather than exploiting other players."
|
12 |
-
"Consider blockers when applicable"
|
13 |
-
"Always discuss how to play your range, not just the hand in question"
|
14 |
-
"Remember to keep your answers short and succinct"
|
15 |
-
"Only answer questions on poker topics"
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
def setup_openai(api_key):
|
20 |
openai.api_key = api_key
|
@@ -23,20 +26,8 @@ def setup_openai(api_key):
|
|
23 |
def ask_joe(api_key, text, clear):
|
24 |
global conversation_history
|
25 |
if clear:
|
26 |
-
# Reset the conversation history
|
27 |
-
conversation_history = [
|
28 |
-
{
|
29 |
-
"role": "system",
|
30 |
-
"content": "Your name is Joe Chip, a world-class poker player..."
|
31 |
-
"If you need more context ask for it."
|
32 |
-
"Make sure you know the effective stack and whether its a cash game or mtt. Ask for clarification if not sure"
|
33 |
-
"Concentrate more on GTO play rather than exploiting other players."
|
34 |
-
"Consider blockers when applicable"
|
35 |
-
"Always discuss how to play your range, not just the hand in question"
|
36 |
-
"Remember to keep your answers short and succinct"
|
37 |
-
"Only answer questions on poker topics"
|
38 |
-
}
|
39 |
-
]
|
40 |
return "Conversation cleared."
|
41 |
|
42 |
# set up the api_key
|
@@ -77,7 +68,7 @@ iface = gr.Interface(
|
|
77 |
inputs=[
|
78 |
gr.inputs.Textbox(label="OpenAI API Key"),
|
79 |
gr.inputs.Textbox(label="Enter your question here. More detail = Better results"),
|
80 |
-
gr.inputs.Checkbox(label="Clear Conversation (tick and press submit to erase
|
81 |
],
|
82 |
outputs=gr.outputs.Textbox(label="Joe's Response")
|
83 |
)
|
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
|
4 |
+
# Initial instructions for the assistant
|
5 |
+
initial_instructions = {
|
6 |
+
"role": "system",
|
7 |
+
"content": (
|
8 |
+
"Your name is Joe Chip, a world-class poker player and communicator."
|
9 |
"If you need more context, ask for it."
|
10 |
+
"Make sure you know the effective stack and whether it's a cash game or mtt. Ask for clarification if not it's not clear."
|
11 |
"Concentrate more on GTO play rather than exploiting other players."
|
12 |
+
"Consider blockers when applicable."
|
13 |
+
"Always discuss how to play your range, not just the hand in question."
|
14 |
+
"Remember to keep your answers short and succinct."
|
15 |
+
"Only answer questions on poker topics."
|
16 |
+
)
|
17 |
+
}
|
18 |
+
|
19 |
+
# Initialize the conversation history with initial instructions
|
20 |
+
conversation_history = [initial_instructions]
|
21 |
|
22 |
def setup_openai(api_key):
|
23 |
openai.api_key = api_key
|
|
|
26 |
def ask_joe(api_key, text, clear):
|
27 |
global conversation_history
|
28 |
if clear:
|
29 |
+
# Reset the conversation history with initial instructions
|
30 |
+
conversation_history = [initial_instructions]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return "Conversation cleared."
|
32 |
|
33 |
# set up the api_key
|
|
|
68 |
inputs=[
|
69 |
gr.inputs.Textbox(label="OpenAI API Key"),
|
70 |
gr.inputs.Textbox(label="Enter your question here. More detail = Better results"),
|
71 |
+
gr.inputs.Checkbox(label="Clear Conversation (tick and press submit to erase Joe's short-term memory)")
|
72 |
],
|
73 |
outputs=gr.outputs.Textbox(label="Joe's Response")
|
74 |
)
|