michaelmc1618 commited on
Commit
25824c1
·
verified ·
1 Parent(s): de07302

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -27
app.py CHANGED
@@ -31,23 +31,25 @@ def respond(message, system_message, max_tokens, temperature, top_p):
31
  response += token
32
  return response
33
 
34
- def generate_prosecution_argument(case_details):
 
35
  system_message = (
36
- "You are an expert Prosecution Attorney. Provide the best and most detailed arguments "
37
- "to prosecute the case based on the given case details. Include thorough analysis, "
38
- "evidence presentation, and any relevant legal precedents."
39
  )
40
- arguments = respond(case_details, system_message, max_tokens=1024, temperature=0.7, top_p=0.95)
41
- return arguments
42
 
43
- def generate_defense_argument(prosecution_argument):
 
44
  system_message = (
45
- "You are an expert Defense Attorney. Provide the best and most detailed arguments "
46
- "to defend the case based on the given case details. Include thorough analysis, "
47
- "evidence presentation, and any relevant legal precedents."
48
  )
49
- arguments = respond(prosecution_argument, system_message, max_tokens=1024, temperature=0.7, top_p=0.95)
50
- return arguments
51
 
52
  # Custom CSS for the specified theme
53
  custom_css = """
@@ -122,25 +124,21 @@ footer {
122
  # Gradio Interface
123
  with gr.Blocks(css=custom_css) as demo:
124
  with gr.Column():
125
- gr.Markdown("# Court Argument Simulation\n### Provide Initial Case Details")
126
- case_details = gr.Textbox(lines=5, placeholder="Enter initial case details here...", label="Initial Case Details", elem_classes="label-hidden")
127
- evidence = gr.Textbox(lines=3, placeholder="Enter evidence details here...", label="Evidence", elem_classes="label-hidden")
128
- witness_statements = gr.Textbox(lines=3, placeholder="Enter witness statements here...", label="Witness Statements", elem_classes="label-hidden")
129
- legal_references = gr.Textbox(lines=3, placeholder="Enter legal references here...", label="Legal References", elem_classes="label-hidden")
130
 
131
- prosecution_argument = gr.Textbox(lines=10, placeholder="Prosecution's Argument...", label="Prosecution's Argument", elem_classes="label-hidden")
132
- defense_argument = gr.Textbox(lines=10, placeholder="Defense's Argument...", label="Defense's Argument", elem_classes="label-hidden")
133
 
134
- def run_simulation(case_details, evidence, witness_statements, legal_references):
135
- full_case_details = f"Case Details: {case_details}\n\nEvidence: {evidence}\n\nWitness Statements: {witness_statements}\n\nLegal References: {legal_references}"
136
- prosecution_arg = generate_prosecution_argument(full_case_details)
137
- defense_arg = generate_defense_argument(prosecution_arg)
138
- return prosecution_arg, defense_arg
139
 
140
- simulate_btn = gr.Button("Start Argument Simulation")
141
- simulate_btn.click(run_simulation, inputs=[case_details, evidence, witness_statements, legal_references], outputs=[prosecution_argument, defense_argument])
142
 
143
  clear_btn = gr.Button("Clear")
144
- clear_btn.click(lambda: ("", "", "", "", "", ""), None, [case_details, evidence, witness_statements, legal_references, prosecution_argument, defense_argument])
145
 
146
  demo.launch()
 
31
  response += token
32
  return response
33
 
34
+ # GDPR Compliance Expert
35
+ def evaluate_gdpr_compliance(audit_data):
36
  system_message = (
37
+ "You are an expert GDPR compliance officer. Assess the audit data for compliance with GDPR regulations. "
38
+ "Provide an analysis that identifies any compliance issues and suggestions for remediation. "
39
+ "Ensure a thorough evaluation of data processing, storage, and protection practices in line with GDPR requirements."
40
  )
41
+ compliance_analysis = respond(audit_data, system_message, max_tokens=1024, temperature=0.7, top_p=0.95)
42
+ return compliance_analysis
43
 
44
+ # PCI Compliance Expert
45
+ def evaluate_pci_compliance(audit_data):
46
  system_message = (
47
+ "You are an expert PCI compliance officer. Assess the audit data for compliance with PCI DSS regulations. "
48
+ "Provide an analysis that identifies any compliance issues and suggestions for remediation. "
49
+ "Ensure a thorough evaluation of payment card data security, storage, and processing practices in line with PCI requirements."
50
  )
51
+ compliance_analysis = respond(audit_data, system_message, max_tokens=1024, temperature=0.7, top_p=0.95)
52
+ return compliance_analysis
53
 
54
  # Custom CSS for the specified theme
55
  custom_css = """
 
124
  # Gradio Interface
125
  with gr.Blocks(css=custom_css) as demo:
126
  with gr.Column():
127
+ gr.Markdown("# GDPR and PCI Compliance Evaluation\n### Provide Audit Data for Compliance Check")
128
+ audit_data = gr.Textbox(lines=5, placeholder="Enter audit data here...", label="Audit Data", elem_classes="label-hidden")
 
 
 
129
 
130
+ gdpr_compliance = gr.Textbox(lines=10, placeholder="GDPR Compliance Analysis...", label="GDPR Compliance Analysis", elem_classes="label-hidden")
131
+ pci_compliance = gr.Textbox(lines=10, placeholder="PCI Compliance Analysis...", label="PCI Compliance Analysis", elem_classes="label-hidden")
132
 
133
+ def run_compliance_checks(audit_data):
134
+ gdpr_analysis = evaluate_gdpr_compliance(audit_data)
135
+ pci_analysis = evaluate_pci_compliance(audit_data)
136
+ return gdpr_analysis, pci_analysis
 
137
 
138
+ check_compliance_btn = gr.Button("Run Compliance Checks")
139
+ check_compliance_btn.click(run_compliance_checks, inputs=[audit_data], outputs=[gdpr_compliance, pci_compliance])
140
 
141
  clear_btn = gr.Button("Clear")
142
+ clear_btn.click(lambda: ("", "", ""), None, [audit_data, gdpr_compliance, pci_compliance])
143
 
144
  demo.launch()