Spaces:
Runtime error
Runtime error
3 chars
Browse files
app.py
CHANGED
|
@@ -16,35 +16,50 @@ def ask(model, system_prompt, pre_prompt, question):
|
|
| 16 |
response = chat(model=model, messages=[
|
| 17 |
{
|
| 18 |
'role': 'system',
|
| 19 |
-
'content': system_prompt,
|
| 20 |
},
|
| 21 |
{
|
| 22 |
'role': 'user',
|
| 23 |
-
'content': f'${
|
| 24 |
},
|
| 25 |
])
|
| 26 |
return response['message']['content']
|
| 27 |
|
| 28 |
|
| 29 |
def main():
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
st.set_page_config(layout="wide")
|
| 36 |
-
st.title("role playing experiments")
|
| 37 |
col1, col2, col3 = st.columns(3)
|
| 38 |
with col1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
st.title("the Teacher")
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
if __name__ == "__main__":
|
|
|
|
| 16 |
response = chat(model=model, messages=[
|
| 17 |
{
|
| 18 |
'role': 'system',
|
| 19 |
+
'content': f"{system_prompt}${pre_prompt}",
|
| 20 |
},
|
| 21 |
{
|
| 22 |
'role': 'user',
|
| 23 |
+
'content': f'${question}',
|
| 24 |
},
|
| 25 |
])
|
| 26 |
return response['message']['content']
|
| 27 |
|
| 28 |
|
| 29 |
def main():
|
| 30 |
+
sp1 = """There are 3 people standing in a circle: the Priest (that's you), the Teacher and the Kid."""
|
| 31 |
+
sp2 = """There are 3 people standing in a circle: the Priest, the Teacher (that's you) and the Kid."""
|
| 32 |
+
sp3 = """There are 3 people standing in a circle: the Priest, the Teacher and the Kid (that's you)."""
|
| 33 |
+
|
| 34 |
+
pp1 = pp2 = pp3 = "Ask the other two by always starting your sentence with their role. Always share your inner thoughts inside parentheses."
|
| 35 |
+
qp1 = qp2 = qp3 = "Your task is to figure out their names and where they live. Do not ask directly, they must not realize what information you are after!"
|
| 36 |
|
| 37 |
st.set_page_config(layout="wide")
|
|
|
|
| 38 |
col1, col2, col3 = st.columns(3)
|
| 39 |
with col1:
|
| 40 |
+
st.title("the Priest")
|
| 41 |
+
model1 = st.selectbox(key="model1", label="model", options=available_models)
|
| 42 |
+
system_prompt1 = st.text_area(key="sp1", label="system-prompt", value=sp1)
|
| 43 |
+
pre_prompt1 = st.text_area(key="pp1", label="pre-prompt", value=pp1)
|
| 44 |
+
question1 = st.text_area(key="q1", label="question", value=qp1)
|
| 45 |
+
|
| 46 |
+
with col2:
|
| 47 |
st.title("the Teacher")
|
| 48 |
+
model2 = st.selectbox(key="model2", label="model", options=available_models)
|
| 49 |
+
system_prompt2 = st.text_area(key="sp2", label="system-prompt", value=sp2)
|
| 50 |
+
pre_prompt2 = st.text_area(key="pp2", label="pre-prompt", value=pp2)
|
| 51 |
+
question2 = st.text_area(key="q2", label="question", value=qp2)
|
| 52 |
+
|
| 53 |
+
with col3:
|
| 54 |
+
st.title("the Kid")
|
| 55 |
+
model3 = st.selectbox(key="model3", label="model", options=available_models)
|
| 56 |
+
system_prompt3 = st.text_area(key="sp3", label="system-prompt", value=sp3)
|
| 57 |
+
pre_prompt3 = st.text_area(key="pp3", label="pre-prompt", value=pp3)
|
| 58 |
+
question3 = st.text_area(key="q3", label="question", value=qp3)
|
| 59 |
+
|
| 60 |
+
with st.spinner("Thinking..."):
|
| 61 |
+
answer1 = ask(model1, system_prompt1, pre_prompt1, question1)
|
| 62 |
+
st.write(answer1)
|
| 63 |
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|