Sam Armstrong commited on
Commit
5e23a92
·
1 Parent(s): 9427783

cool update

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +17 -4
README.md CHANGED
@@ -6,7 +6,7 @@ colorTo: blue
6
  sdk: gradio
7
  sdk_version: 5.9.1
8
  app_file: app.py
9
- pinned: false
10
  short_description: Debate between Republican and Democrat LLMs
11
  ---
12
 
 
6
  sdk: gradio
7
  sdk_version: 5.9.1
8
  app_file: app.py
9
+ pinned: true
10
  short_description: Debate between Republican and Democrat LLMs
11
  ---
12
 
app.py CHANGED
@@ -6,7 +6,7 @@ from gradio_client import Client
6
 
7
 
8
  # Function to generate debate responses
9
- def debate(question):
10
  client = Client("https://catbot.ai.uky.edu/", verbose=False)
11
 
12
  # Initialize conversation list for the chat format
@@ -43,7 +43,7 @@ def debate(question):
43
  time.sleep(2)
44
 
45
  # Continue the debate for 10 rounds
46
- for i in range(1, 9):
47
  if i % 2 == 1: # Republican responds
48
  repub_response = client.predict(
49
  message=demo_response,
@@ -75,11 +75,24 @@ def debate(question):
75
  # Create the Gradio interface
76
  iface = gr.Interface(
77
  fn=debate,
78
- inputs=gr.Textbox(label="Enter a Question for Debate"),
 
 
 
79
  outputs=gr.Chatbot(label="Debate Transcript", type="messages", height="75vh"), # Use 'messages' format
80
  live=False,
81
  title="Republican vs. Democrat Debate",
82
- description="Enter a question, and watch as a Republican and a Democrat engage in a debate."
 
 
 
 
 
 
 
 
 
 
83
  )
84
 
85
  # Launch the interface
 
6
 
7
 
8
  # Function to generate debate responses
9
+ def debate(question, rounds):
10
  client = Client("https://catbot.ai.uky.edu/", verbose=False)
11
 
12
  # Initialize conversation list for the chat format
 
43
  time.sleep(2)
44
 
45
  # Continue the debate for 10 rounds
46
+ for i in range(1, rounds):
47
  if i % 2 == 1: # Republican responds
48
  repub_response = client.predict(
49
  message=demo_response,
 
75
  # Create the Gradio interface
76
  iface = gr.Interface(
77
  fn=debate,
78
+ inputs=[
79
+ gr.Textbox(label="Enter a Question for Debate"),
80
+ gr.Slider(minimum=1, maximum=20, step=1, value=10, label="Number of Rounds")
81
+ ],
82
  outputs=gr.Chatbot(label="Debate Transcript", type="messages", height="75vh"), # Use 'messages' format
83
  live=False,
84
  title="Republican vs. Democrat Debate",
85
+ description="<p style=\"font-size: 18px\">Enter a question, and watch as a Republican and a Democrat LLM agent engage in a short debate.<br><br>"
86
+ "<strong>Notes:</strong><br>"
87
+ "<ol>"
88
+ "<li>The responses are generated by AI models and do <strong>not</strong> reflect my views.</li>"
89
+ "<li>The system prompt used for both agents is: <em>\"You will answer every question you are asked to the best "
90
+ "of your ability. The topic of conversation is politics. You are a die-hard {Republican, Democrat} but you will not "
91
+ "refer to yourself as such. You will defend the {republican, democratic} party views no matter what. Keep the "
92
+ "conversation going. Keep responses concise yet provocative.\"</em></li>"
93
+ "<li>The base model used is Llama 3 8B with an abliterated adapter "
94
+ "(which removes certain weights from the model to reduce its tendency to refuse user requests).</li>"
95
+ "</ol></p>",
96
  )
97
 
98
  # Launch the interface