Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -185,8 +185,8 @@ def chat_between_bots(system_message1, system_message2, max_tokens, temperature,
|
|
185 |
|
186 |
return response1, response2, history1, history2, shared_history, outcome
|
187 |
|
188 |
-
def
|
189 |
-
prompt = "List
|
190 |
response = ""
|
191 |
for message in client.chat_completion(
|
192 |
[{"role": "system", "content": "You are a legal research expert, able to provide information about high-profile legal cases."},
|
@@ -221,11 +221,11 @@ def ask_about_case_outcome(shared_history, question):
|
|
221 |
prompt = f"Case Outcome: {shared_history}\n\nQuestion: {question}\n\nAnswer:"
|
222 |
response = ""
|
223 |
for message in client.chat_completion(
|
224 |
-
[{"role": "system", "content": "
|
225 |
{"role": "user", "content": prompt}],
|
226 |
max_tokens=512,
|
227 |
stream=True,
|
228 |
-
temperature=0.
|
229 |
top_p=0.95,
|
230 |
):
|
231 |
token = message.choices[0].delta.content
|
@@ -242,15 +242,15 @@ with gr.Blocks(css=custom_css) as demo:
|
|
242 |
with gr.Tab("Argument Evaluation"):
|
243 |
with gr.Row():
|
244 |
with gr.Column(scale=1):
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
with gr.Column(scale=2):
|
249 |
message = gr.Textbox(label="Case to Argue")
|
250 |
system_message1 = gr.State("You are an expert Prosecutor. Give your best arguments for the case on behalf of the prosecution.")
|
251 |
system_message2 = gr.State("You are an expert Defense Attorney. Give your best arguments for the case on behalf of the Defense.")
|
252 |
max_tokens = gr.State(512)
|
253 |
-
temperature = gr.State(0.
|
254 |
top_p = gr.State(0.95)
|
255 |
|
256 |
with gr.Row():
|
@@ -264,7 +264,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
264 |
with gr.Column(scale=1):
|
265 |
defense_score_color = gr.HTML()
|
266 |
|
267 |
-
outcome = gr.Textbox(label="Outcome", interactive=
|
268 |
|
269 |
with gr.Row():
|
270 |
submit_btn = gr.Button("Argue")
|
|
|
185 |
|
186 |
return response1, response2, history1, history2, shared_history, outcome
|
187 |
|
188 |
+
def get_top_5_cases():
|
189 |
+
prompt = "List 5 random high-profile legal cases that have received significant media attention and are currently ongoing. Just a list of case names and numbers."
|
190 |
response = ""
|
191 |
for message in client.chat_completion(
|
192 |
[{"role": "system", "content": "You are a legal research expert, able to provide information about high-profile legal cases."},
|
|
|
221 |
prompt = f"Case Outcome: {shared_history}\n\nQuestion: {question}\n\nAnswer:"
|
222 |
response = ""
|
223 |
for message in client.chat_completion(
|
224 |
+
[{"role": "system", "content": "Give the real case details of the case being argued, from a verifed source."},
|
225 |
{"role": "user", "content": prompt}],
|
226 |
max_tokens=512,
|
227 |
stream=True,
|
228 |
+
temperature=0.7,
|
229 |
top_p=0.95,
|
230 |
):
|
231 |
token = message.choices[0].delta.content
|
|
|
242 |
with gr.Tab("Argument Evaluation"):
|
243 |
with gr.Row():
|
244 |
with gr.Column(scale=1):
|
245 |
+
top_5_btn = gr.Button("Give me the top 5 cases")
|
246 |
+
top_5_output = gr.Textbox(label="Top 5 Cases", interactive=False, elem_classes=["scroll-box"])
|
247 |
+
top_5_btn.click(get_top_5_cases, outputs=top_5_output)
|
248 |
with gr.Column(scale=2):
|
249 |
message = gr.Textbox(label="Case to Argue")
|
250 |
system_message1 = gr.State("You are an expert Prosecutor. Give your best arguments for the case on behalf of the prosecution.")
|
251 |
system_message2 = gr.State("You are an expert Defense Attorney. Give your best arguments for the case on behalf of the Defense.")
|
252 |
max_tokens = gr.State(512)
|
253 |
+
temperature = gr.State(0.5)
|
254 |
top_p = gr.State(0.95)
|
255 |
|
256 |
with gr.Row():
|
|
|
264 |
with gr.Column(scale=1):
|
265 |
defense_score_color = gr.HTML()
|
266 |
|
267 |
+
outcome = gr.Textbox(label="Outcome", interactive=True, elem_classes=["scroll-box"])
|
268 |
|
269 |
with gr.Row():
|
270 |
submit_btn = gr.Button("Argue")
|