michaelmc1618 commited on
Commit
ff643c7
·
verified ·
1 Parent(s): 93cce50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -50,7 +50,7 @@ def respond(
50
  yield response, history + [(message, response)]
51
 
52
  def generate_case_outcome(prosecutor_response, defense_response):
53
- prompt = "Provide details on who won the case and why. Provide reasons for your decision and provide a link to the source of the case."
54
  evaluation = ""
55
  for message in client.chat_completion(
56
  [{"role": "system", "content": "You are a legal expert evaluating the details of the case presented by the prosecution and the defense."},
@@ -66,14 +66,11 @@ def generate_case_outcome(prosecutor_response, defense_response):
66
  return evaluation
67
 
68
  def determine_winner(outcome):
69
- if "Prosecutor" in outcome and "Defense" in outcome:
70
- if "Prosecutor" in outcome.split().count("Prosecutor") > outcome.split().count("Defense"):
71
- return "Prosecutor Wins"
72
- else:
73
- return "Defense Wins"
74
- elif "Prosecutor" in outcome:
75
  return "Prosecutor Wins"
76
- elif "Defense" in outcome:
77
  return "Defense Wins"
78
  else:
79
  return "No clear winner"
@@ -202,7 +199,7 @@ def update_pdf_gallery_and_extract_text(pdf_files):
202
  return pdf_files, pdf_text
203
 
204
  def get_top_10_cases():
205
- prompt = " 10 high-profile legal cases that have received significant media attention and are currently ongoing. Just a list of case names and numbers"
206
  response = ""
207
  for message in client.chat_completion(
208
  [{"role": "system", "content": "You are a legal research expert, able to provide information about high-profile legal cases."},
 
50
  yield response, history + [(message, response)]
51
 
52
  def generate_case_outcome(prosecutor_response, defense_response):
53
+ prompt = f"Prosecutor's arguments: {prosecutor_response}\n\nDefense's arguments: {defense_response}\n\nProvide details on who won the case and why. Provide reasons for your decision and provide a link to the source of the case."
54
  evaluation = ""
55
  for message in client.chat_completion(
56
  [{"role": "system", "content": "You are a legal expert evaluating the details of the case presented by the prosecution and the defense."},
 
66
  return evaluation
67
 
68
  def determine_winner(outcome):
69
+ prosecutor_count = outcome.split().count("Prosecutor")
70
+ defense_count = outcome.split().count("Defense")
71
+ if prosecutor_count > defense_count:
 
 
 
72
  return "Prosecutor Wins"
73
+ elif defense_count > prosecutor_count:
74
  return "Defense Wins"
75
  else:
76
  return "No clear winner"
 
199
  return pdf_files, pdf_text
200
 
201
  def get_top_10_cases():
202
+ prompt = "List 10 random high-profile legal cases that have received significant media attention and are currently ongoing. Just a list of case names and numbers."
203
  response = ""
204
  for message in client.chat_completion(
205
  [{"role": "system", "content": "You are a legal research expert, able to provide information about high-profile legal cases."},