Shashank1406
commited on
Commit
•
d133141
1
Parent(s):
a1ec0b0
Update utills.py
Browse files
utills.py
CHANGED
@@ -1,88 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
lawyer_db = [
|
4 |
-
{"id": 1, "name": "Rajesh Kumar", "specialty": "Criminal", "experience": "11-20 years", "cost_range": "High", "location": "Jabalpur", "rating": 4.8, "description": "Specializes in IPC cases, has successfully defended in multiple murder trials."},
|
5 |
-
{"id": 2, "name": "Priya Sharma", "specialty": "Family", "experience": "6-10 years", "cost_range": "Medium", "location": "Bhopal", "rating": 4.5, "description": "Expert in divorce cases and child custody battles under Hindu Marriage Act."},
|
6 |
-
{"id": 3, "name": "Amit Patel", "specialty": "Corporate", "experience": "20+ years", "cost_range": "Very High", "location": "Indore", "rating": 4.9, "description": "Handled major mergers and acquisitions, expert in Company Law and SEBI regulations."},
|
7 |
-
{"id": 4, "name": "Neha Gupta", "specialty": "Immigration", "experience": "0-5 years", "cost_range": "Low", "location": "Gwalior", "rating": 4.2, "description": "Specializes in student visas and work permits for IT professionals."},
|
8 |
-
{"id": 5, "name": "Vikram Singh", "specialty": "Criminal", "experience": "11-20 years", "cost_range": "Medium", "location": "Bhopal", "rating": 4.7, "description": "Former public prosecutor, expert in cybercrime cases under IT Act."},
|
9 |
-
{"id": 6, "name": "Anita Desai", "specialty": "Family", "experience": "20+ years", "cost_range": "High", "location": "Indore", "rating": 4.6, "description": "Specializes in inter-faith marriages and Special Marriage Act cases."},
|
10 |
-
{"id": 7, "name": "Sanjay Mehta", "specialty": "Corporate", "experience": "11-20 years", "cost_range": "High", "location": "Jabalpur", "rating": 4.5, "description": "Expert in Intellectual Property Rights and patent law."},
|
11 |
-
{"id": 8, "name": "Kavita Reddy", "specialty": "Immigration", "experience": "6-10 years", "cost_range": "Medium", "location": "Bhopal", "rating": 4.3, "description": "Specializes in NRI property disputes and OCI card issues."},
|
12 |
-
{"id": 9, "name": "Arjun Malhotra", "specialty": "Criminal", "experience": "20+ years", "cost_range": "Very High", "location": "Indore", "rating": 4.9, "description": "Renowned for handling high-profile corruption cases under Prevention of Corruption Act."},
|
13 |
-
{"id": 10, "name": "Deepa Joshi", "specialty": "Family", "experience": "0-5 years", "cost_range": "Low", "location": "Gwalior", "rating": 4.1, "description": "Focuses on domestic violence cases under Protection of Women from Domestic Violence Act."},
|
14 |
-
{"id": 11, "name": "Rahul Verma", "specialty": "Corporate", "experience": "6-10 years", "cost_range": "Medium", "location": "Jabalpur", "rating": 4.4, "description": "Specializes in startup law and venture capital regulations."},
|
15 |
-
{"id": 12, "name": "Sunita Agarwal", "specialty": "Immigration", "experience": "11-20 years", "cost_range": "High", "location": "Bhopal", "rating": 4.7, "description": "Expert in handling complex deportation cases and appeals."},
|
16 |
-
{"id": 13, "name": "Kiran Bedi", "specialty": "Criminal", "experience": "20+ years", "cost_range": "Very High", "location": "Indore", "rating": 4.8, "description": "Former IPS officer, specializes in police brutality and human rights violation cases."},
|
17 |
-
{"id": 14, "name": "Vivek Chauhan", "specialty": "Family", "experience": "11-20 years", "cost_range": "High", "location": "Gwalior", "rating": 4.6, "description": "Expert in adoption cases and surrogacy law in India."},
|
18 |
-
{"id": 15, "name": "Meera Saxena", "specialty": "Corporate", "experience": "20+ years", "cost_range": "Very High", "location": "Jabalpur", "rating": 4.9, "description": "Specializes in banking law and financial regulations, handled major NPAs cases."},
|
19 |
-
{"id": 16, "name": "Alok Nath", "specialty": "Immigration", "experience": "6-10 years", "cost_range": "Medium", "location": "Bhopal", "rating": 4.3, "description": "Expert in handling asylum cases and refugee status applications."},
|
20 |
-
{"id": 17, "name": "Pooja Bhatt", "specialty": "Criminal", "experience": "0-5 years", "cost_range": "Low", "location": "Indore", "rating": 4.2, "description": "Specializes in juvenile justice cases under Juvenile Justice Act."},
|
21 |
-
{"id": 18, "name": "Rohit Sharma", "specialty": "Family", "experience": "11-20 years", "cost_range": "High", "location": "Gwalior", "rating": 4.7, "description": "Expert in handling LGBTQ+ rights cases and same-sex partnership issues."},
|
22 |
-
{"id": 19, "name": "Nandini Roy", "specialty": "Corporate", "experience": "6-10 years", "cost_range": "Medium", "location": "Jabalpur", "rating": 4.5, "description": "Specializes in environmental law and corporate social responsibility cases."},
|
23 |
-
{"id": 20, "name": "Ajay Devgan", "specialty": "Immigration", "experience": "20+ years", "cost_range": "Very High", "location": "Bhopal", "rating": 4.8, "description": "Expert in handling complex citizenship cases and constitutional challenges."},
|
24 |
-
{"id": 21, "name": "Ravi Shankar", "specialty": "Criminal", "experience": "6-10 years", "cost_range": "Medium", "location": "Jabalpur", "rating": 4.4, "description": "Specializes in white-collar crimes and economic offenses."},
|
25 |
-
{"id": 22, "name": "Anjali Kapoor", "specialty": "Family", "experience": "20+ years", "cost_range": "Very High", "location": "Bhopal", "rating": 4.8, "description": "Expert in high-net-worth divorce cases and property disputes."},
|
26 |
-
{"id": 23, "name": "Suresh Patel", "specialty": "Corporate", "experience": "0-5 years", "cost_range": "Low", "location": "Indore", "rating": 4.0, "description": "Focuses on startup incorporation and compliance issues."},
|
27 |
-
{"id": 24, "name": "Preeti Singhania", "specialty": "Immigration", "experience": "11-20 years", "cost_range": "High", "location": "Gwalior", "rating": 4.6, "description": "Specializes in business immigration and investor visas."},
|
28 |
-
{"id": 25, "name": "Arun Jaitley", "specialty": "Criminal", "experience": "20+ years", "cost_range": "Very High", "location": "Jabalpur", "rating": 4.9, "description": "Renowned for handling high-profile criminal cases and constitutional matters."},
|
29 |
-
{"id": 26, "name": "Shalini Mishra", "specialty": "Family", "experience": "6-10 years", "cost_range": "Medium", "location": "Indore", "rating": 4.3, "description": "Specializes in child rights and juvenile law."},
|
30 |
-
{"id": 27, "name": "Vijay Mallya", "specialty": "Corporate", "experience": "11-20 years", "cost_range": "High", "location": "Bhopal", "rating": 4.7, "description": "Expert in corporate restructuring and insolvency cases."},
|
31 |
-
{"id": 28, "name": "Aarti Chabria", "specialty": "Immigration", "experience": "0-5 years", "cost_range": "Low", "location": "Jabalpur", "rating": 4.1, "description": "Focuses on family-based immigration and naturalization cases."},
|
32 |
-
{"id": 29, "name": "Ranveer Kapoor", "specialty": "Criminal", "experience": "6-10 years", "cost_range": "Medium", "location": "Gwalior", "rating": 4.4, "description": "Specializes in drug-related offenses and NDPS Act cases."},
|
33 |
-
{"id": 30, "name": "Sneha Agarwal", "specialty": "Family", "experience": "11-20 years", "cost_range": "High", "location": "Bhopal", "rating": 4.6, "description": "Expert in handling complex custody battles and international family law cases."},
|
34 |
-
{"id": 31, "name": "Raj Malhotra", "specialty": "Corporate", "experience": "20+ years", "cost_range": "Very High", "location": "Indore", "rating": 4.9, "description": "Specializes in cross-border transactions and international trade law."},
|
35 |
-
{"id": 32, "name": "Zoya Khan", "specialty": "Immigration", "experience": "6-10 years", "cost_range": "Medium", "location": "Jabalpur", "rating": 4.3, "description": "Expert in handling visa appeals and deportation defense cases."},
|
36 |
-
{"id": 33, "name": "Aryan Khanna", "specialty": "Criminal", "experience": "0-5 years", "cost_range": "Low", "location": "Bhopal", "rating": 4.0, "description": "Focuses on petty crimes and first-time offender cases."},
|
37 |
-
{"id": 34, "name": "Ishaan Sharma", "specialty": "Family", "experience": "20+ years", "cost_range": "Very High", "location": "Gwalior", "rating": 4.8, "description": "Renowned for handling high-profile divorce cases involving public figures."},
|
38 |
-
{"id": 35, "name": "Aditi Rao", "specialty": "Corporate", "experience": "11-20 years", "cost_range": "High", "location": "Indore", "rating": 4.7, "description": "Specializes in corporate governance and compliance issues."},
|
39 |
-
{"id": 36, "name": "Kabir Singh", "specialty": "Immigration", "experience": "20+ years", "cost_range": "Very High", "location": "Jabalpur", "rating": 4.9, "description": "Expert in complex immigration litigation and federal court appeals."},
|
40 |
-
{"id": 37, "name": "Neha Dhupia", "specialty": "Criminal", "experience": "11-20 years", "cost_range": "High", "location": "Bhopal", "rating": 4.6, "description": "Specializes in cyber law and online fraud cases."},
|
41 |
-
{"id": 38, "name": "Rajat Kapoor", "specialty": "Family", "experience": "0-5 years", "cost_range": "Low", "location": "Indore", "rating": 4.1, "description": "Focuses on family mediation and collaborative divorce processes."},
|
42 |
-
{"id": 39, "name": "Dia Mirza", "specialty": "Corporate", "experience": "6-10 years", "cost_range": "Medium", "location": "Gwalior", "rating": 4.4, "description": "Specializes in entertainment law and intellectual property rights in media."},
|
43 |
-
{"id": 40, "name": "Farhan Akhtar", "specialty": "Immigration", "experience": "11-20 years", "cost_range": "High", "location": "Bhopal", "rating": 4.7, "description": "Expert in handling employment-based immigration and labor certification cases."}
|
44 |
-
]
|
45 |
-
|
46 |
-
|
47 |
-
def search_lawyers(category, cost_range, experience, location):
|
48 |
-
print(f"Searching for - Category: {category}, Cost Range: {cost_range}, Experience: {experience}, Location: {location}")
|
49 |
-
|
50 |
-
def find_matches(specialty_match, cost_match, experience_match, location_match):
|
51 |
-
return [
|
52 |
-
lawyer for lawyer in lawyer_db
|
53 |
-
if (specialty_match == "any" or lawyer["specialty"] == category)
|
54 |
-
and (cost_match == "any" or lawyer["cost_range"] == cost_range)
|
55 |
-
and (experience_match == "any" or lawyer["experience"] == experience)
|
56 |
-
and (location_match == "any" or lawyer["location"] == location)
|
57 |
-
]
|
58 |
-
|
59 |
-
# Try exact match
|
60 |
-
matching_lawyers = find_matches(category, cost_range, experience, location)
|
61 |
-
|
62 |
-
# Relax location
|
63 |
-
if not matching_lawyers:
|
64 |
-
matching_lawyers = find_matches(category, cost_range, experience, "any")
|
65 |
-
print("Relaxed location criteria")
|
66 |
-
|
67 |
-
# Relax cost range
|
68 |
-
if not matching_lawyers:
|
69 |
-
matching_lawyers = find_matches(category, "any", experience, "any")
|
70 |
-
print("Relaxed cost range criteria")
|
71 |
-
|
72 |
-
# Relax experience
|
73 |
-
if not matching_lawyers:
|
74 |
-
matching_lawyers = find_matches(category, "any", "any", "any")
|
75 |
-
print("Relaxed experience criteria")
|
76 |
-
|
77 |
-
# Relax specialty (return all lawyers if no matches found)
|
78 |
-
if not matching_lawyers:
|
79 |
-
matching_lawyers = find_matches("any", "any", "any", "any")
|
80 |
-
print("Relaxed all criteria")
|
81 |
-
|
82 |
-
print(f"Total matches found: {len(matching_lawyers)}")
|
83 |
-
|
84 |
-
return matching_lawyers
|
85 |
-
|
86 |
def on_click_toggle():
|
87 |
st.session_state.update({
|
88 |
"selected_model": "gpt-4o" if st.session_state["selected_model"] == "gpt-3.5-turbo-16k" else "gpt-3.5-turbo-16k"
|
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def on_click_toggle():
|
4 |
st.session_state.update({
|
5 |
"selected_model": "gpt-4o" if st.session_state["selected_model"] == "gpt-3.5-turbo-16k" else "gpt-3.5-turbo-16k"
|