sunbal7 commited on
Commit
e7dc437
·
verified ·
1 Parent(s): 41d5de2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +178 -172
app.py CHANGED
@@ -1,19 +1,26 @@
1
  # app.py
2
  import streamlit as st
3
- import requests
4
  import time
5
  import plotly.express as px
6
- import os
7
  from dotenv import load_dotenv
8
 
9
  # Load environment variables
10
  load_dotenv()
11
 
 
 
 
 
 
 
 
12
  # Set up Streamlit page
13
  st.set_page_config(
14
- page_title="Legal Rights Explorer",
15
  page_icon="⚖️",
16
- layout="wide",
17
  initial_sidebar_state="collapsed"
18
  )
19
 
@@ -23,119 +30,148 @@ st.markdown("""
23
  :root {
24
  --primary: #2c3e50;
25
  --secondary: #3498db;
26
- --accent: #e74c3c;
27
  --light: #ecf0f1;
28
  --dark: #2c3e50;
29
  --success: #27ae60;
30
- --card-shadow: 0 6px 20px rgba(0,0,0,0.1);
 
31
  }
32
 
33
  .stApp {
34
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
35
  color: #333;
36
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
 
 
37
  }
38
 
39
  .header {
40
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
41
  color: white;
42
- padding: 1.8rem 2rem;
43
- border-radius: 0 0 20px 20px;
44
  box-shadow: var(--card-shadow);
45
  margin-bottom: 2.5rem;
 
46
  }
47
 
48
  .card {
49
  background: white;
50
- border-radius: 15px;
51
- padding: 1.8rem;
52
  box-shadow: var(--card-shadow);
53
- margin-bottom: 1.8rem;
54
- transition: all 0.3s ease;
55
- border-left: 4px solid var(--secondary);
56
  }
57
 
58
  .card:hover {
59
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
60
- transform: translateY(-5px);
61
  }
62
 
63
  .scenario-btn {
64
  width: 100%;
65
- padding: 1.1rem;
66
  background: linear-gradient(135deg, var(--secondary) 0%, #2980b9 100%);
67
  color: white;
68
  border: none;
69
- border-radius: 12px;
70
  font-weight: 600;
71
- margin: 0.7rem 0;
72
  cursor: pointer;
73
- transition: all 0.3s ease;
74
  text-align: left;
75
- padding-left: 20px;
76
- font-size: 1.05rem;
 
77
  }
78
 
79
  .scenario-btn:hover {
80
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
81
- transform: scale(1.02);
 
82
  }
83
 
84
  .response-card {
85
  background: white;
86
  border-left: 5px solid var(--success);
87
- border-radius: 12px;
88
- padding: 2rem;
89
- margin-top: 2rem;
90
  box-shadow: var(--card-shadow);
91
- animation: fadeIn 0.6s ease;
92
  }
93
 
94
  .country-card {
95
  display: flex;
96
  align-items: center;
97
  gap: 15px;
98
- padding: 1.2rem;
99
- border-radius: 12px;
100
  background: white;
101
  box-shadow: var(--card-shadow);
102
- margin-bottom: 15px;
103
  cursor: pointer;
104
- transition: all 0.3s ease;
 
105
  }
106
 
107
  .country-card:hover {
108
- transform: translateX(5px);
109
- box-shadow: 0 8px 25px rgba(0,0,0,0.15);
110
  }
111
 
112
  .country-card.selected {
113
- background: linear-gradient(135deg, var(--light) 0%, var(--secondary) 100%);
114
- border-left: 4px solid var(--accent);
 
115
  }
116
 
117
  .footer {
118
  text-align: center;
119
- padding: 2rem;
120
- margin-top: 3rem;
121
  color: var(--dark);
122
- font-size: 0.95rem;
123
  background: rgba(236, 240, 241, 0.7);
124
- border-radius: 15px;
 
 
 
 
 
 
 
125
  }
126
 
127
  @keyframes fadeIn {
128
- from { opacity: 0; transform: translateY(20px); }
129
  to { opacity: 1; transform: translateY(0); }
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
132
  @media (max-width: 768px) {
133
  .header {
134
- padding: 1.3rem;
135
  }
136
 
137
  .card {
138
- padding: 1.3rem;
 
 
 
 
 
139
  }
140
  }
141
  </style>
@@ -154,7 +190,7 @@ COUNTRIES = {
154
  "🇧🇷 Brazil": "BR",
155
  "🇿🇦 South Africa": "ZA",
156
  "🇪🇸 Spain": "ES",
157
- "🇮🇹 Italy": "IT"
158
  }
159
 
160
  # Common legal scenarios
@@ -173,114 +209,88 @@ SCENARIOS = [
173
  "Immigration Rights"
174
  ]
175
 
176
- # Simulated API function
177
- def get_legal_rights(country, scenario):
178
- """Simulate API response with country-specific legal rights"""
179
- # In a real implementation, this would call an external API
180
- # For this demo, we'll return simulated responses
181
-
182
- # Simulate API delay
183
- time.sleep(1.5)
184
-
185
- # Base rights that apply to most countries
186
- base_rights = [
187
- "Right to remain silent",
188
- "Right to legal representation",
189
- "Right to be treated with dignity and respect",
190
- "Right to understand the charges against you",
191
- "Right to a fair and impartial process"
192
- ]
193
-
194
- # Country-specific additions
195
- country_specific = {
196
- "US": [
197
- "Right to refuse unwarranted searches (4th Amendment)",
198
- "Right to due process (5th Amendment)",
199
- "Right to a speedy and public trial (6th Amendment)"
200
- ],
201
- "UK": [
202
- "Right to legal advice under the Police and Criminal Evidence Act",
203
- "Right to have someone informed of your arrest",
204
- "Protection under the Human Rights Act 1998"
205
- ],
206
- "CA": [
207
- "Right to be informed of the reason for detention (Charter of Rights)",
208
- "Right to retain and instruct counsel without delay",
209
- "Right to habeas corpus"
210
- ],
211
- "AU": [
212
- "Right to silence during police questioning",
213
- "Right to communicate with a friend or relative",
214
- "Protection under the Australian Human Rights Commission Act"
215
- ],
216
- "IN": [
217
- "Right to free legal aid under Article 39A of the Constitution",
218
- "Protection against self-incrimination (Article 20)",
219
- "Right to be informed of grounds for arrest (Article 22)"
220
- ]
221
- }
222
-
223
- # Scenario-specific additions
224
- scenario_specific = {
225
- "Traffic Stop by Police": [
226
- "Right to see official identification",
227
- "Right to know the reason for the stop",
228
- "Right to refuse a search without probable cause",
229
- "Right to record the interaction"
230
- ],
231
- "Workplace Discrimination": [
232
- "Right to a discrimination-free workplace",
233
- "Right to report without retaliation",
234
- "Right to reasonable accommodations",
235
- "Right to equal pay for equal work"
236
- ],
237
- "Medical Emergency Rights": [
238
- "Right to emergency treatment regardless of insurance",
239
- "Right to informed consent",
240
- "Right to access medical records",
241
- "Right to privacy of health information"
242
- ],
243
- "Arrest or Detention": [
244
- "Right to be informed of charges",
245
- "Right to contact your embassy if foreign national",
246
- "Right to humane treatment",
247
- "Right to challenge the lawfulness of detention"
248
- ]
249
- }
250
 
251
- # Combine rights based on country and scenario
252
- rights = base_rights.copy()
 
 
 
 
 
 
 
 
 
253
 
254
- if country in country_specific:
255
- rights.extend(country_specific[country])
 
256
 
257
- for key, value in scenario_specific.items():
258
- if key in scenario:
259
- rights.extend(value)
260
- break
261
 
262
- # Format the response
263
- response = f"## 🔍 Your Rights in {country}\n"
264
- response += f"### Situation: {scenario}\n\n"
265
- response += "Based on the laws of your selected country, you have the following rights:\n\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
- for i, right in enumerate(set(rights), 1):
268
- response += f" **{right}**\n\n"
 
 
 
 
 
 
 
269
 
270
- response += "\n**Important Notes:**\n"
271
- response += "- This information is for educational purposes only\n"
272
- response += "- Laws vary by jurisdiction and circumstances\n"
273
- response += "- Consult a qualified attorney for legal advice\n"
 
 
274
 
275
- return response
 
276
 
277
  # Main app
278
  def main():
279
  # Header section
280
  st.markdown("""
281
  <div class="header">
282
- <h1 style="margin:0;font-size:2.3rem;">Legal Rights Explorer</h1>
283
- <p style="margin:0;font-size:1.2rem;opacity:0.9;">Know your rights in any situation, anywhere in the world</p>
284
  </div>
285
  """, unsafe_allow_html=True)
286
 
@@ -291,8 +301,18 @@ def main():
291
  if 'selected_scenario' not in st.session_state:
292
  st.session_state.selected_scenario = None
293
 
 
 
 
 
 
 
 
 
 
 
294
  # Main content columns
295
- col1, col2 = st.columns([1, 2], gap="large")
296
 
297
  with col1:
298
  st.markdown("### 🌍 Select Your Country")
@@ -301,14 +321,14 @@ def main():
301
  # Country selection cards
302
  for country_display in COUNTRIES.keys():
303
  is_selected = st.session_state.selected_country == country_display
304
- card_class = "country-card selected" if is_selected else "country-card"
305
 
306
- st.markdown(f"""
307
- <div class="{card_class}" onclick="selectCountry('{country_display}')">
308
- <span style="font-size:1.8rem;">{country_display.split()[0]}</span>
309
- <span style="font-weight:500;">{country_display.split(' ', 1)[1]}</span>
310
- </div>
311
- """, unsafe_allow_html=True)
 
312
 
313
  # Country visualization
314
  st.markdown("### 📊 Global Rights Index")
@@ -320,7 +340,7 @@ def main():
320
  y=awareness,
321
  labels={'x': 'Country', 'y': 'Rights Awareness'},
322
  color=awareness,
323
- color_continuous_scale='Blues',
324
  height=300
325
  )
326
  fig.update_layout(
@@ -331,12 +351,13 @@ def main():
331
  st.plotly_chart(fig, use_container_width=True)
332
 
333
  # Legal resources
334
- with st.expander("📚 Legal Resources"):
335
  st.markdown("""
336
  - [United Nations Human Rights](https://www.ohchr.org/)
337
  - [International Justice Resource Center](https://ijrcenter.org/)
338
  - [Global Legal Information Network](https://www.loc.gov/law/help/legal-info.php)
339
  - [World Legal Information Institute](https://www.worldlii.org/)
 
340
  """)
341
 
342
  with col2:
@@ -356,28 +377,29 @@ def main():
356
  st.session_state.selected_scenario = scenario
357
 
358
  # Custom scenario input
359
- custom_scenario = st.text_input("**Or describe your specific situation:**", placeholder="e.g., 'Rights during home search'")
360
  if custom_scenario:
361
  st.session_state.selected_scenario = custom_scenario
362
 
363
  # Response area
364
- st.markdown("### ⚖️ Your Legal Rights")
365
 
366
  if st.session_state.selected_scenario:
367
  country_code = COUNTRIES[st.session_state.selected_country]
368
 
369
- with st.spinner(f"Analyzing your rights for {st.session_state.selected_scenario} in {country_code}..."):
370
  response = get_legal_rights(
371
  country_code,
372
- st.session_state.selected_scenario
 
373
  )
374
 
375
  if response:
376
- st.markdown(f'<div class="response-card">{response}</div>', unsafe_allow_html=True)
377
  else:
378
  st.error("Failed to get response. Please try again.")
379
  else:
380
- st.info("Please select a legal scenario to see your rights information")
381
  st.image("https://images.unsplash.com/photo-1589391886645-d51941baf7fb?auto=format&fit=crop&w=600&h=400",
382
  caption="Know Your Rights, Exercise Your Freedom")
383
 
@@ -399,28 +421,12 @@ def main():
399
  # Footer
400
  st.markdown("""
401
  <div class="footer">
402
- <p>Legal Rights Explorer | © 2023 | For Educational Purposes Only | Not Legal Advice</p>
403
- <p>Always consult a qualified attorney in your jurisdiction for your specific legal situation</p>
 
 
404
  </div>
405
  """, unsafe_allow_html=True)
406
-
407
- # JavaScript for country selection
408
- st.markdown("""
409
- <script>
410
- function selectCountry(country) {
411
- window.parent.document.querySelectorAll("button[kind='secondary']")[0].click();
412
- setTimeout(function() {
413
- const countryButtons = window.parent.document.querySelectorAll("button[kind='secondary']");
414
- for (let btn of countryButtons) {
415
- if (btn.innerText.includes(country)) {
416
- btn.click();
417
- break;
418
- }
419
- }
420
- }, 100);
421
- }
422
- </script>
423
- """, unsafe_allow_html=True)
424
 
425
  if __name__ == "__main__":
426
  main()
 
1
  # app.py
2
  import streamlit as st
3
+ import os
4
  import time
5
  import plotly.express as px
6
+ from groq import Groq
7
  from dotenv import load_dotenv
8
 
9
  # Load environment variables
10
  load_dotenv()
11
 
12
+ # Initialize Groq client
13
+ try:
14
+ client = Groq(api_key=os.getenv("GROQ_API_KEY"))
15
+ except:
16
+ st.error("Failed to initialize Groq client. Please check your API key.")
17
+ st.stop()
18
+
19
  # Set up Streamlit page
20
  st.set_page_config(
21
+ page_title="Legal Rights Explorer Pro",
22
  page_icon="⚖️",
23
+ layout="centered",
24
  initial_sidebar_state="collapsed"
25
  )
26
 
 
30
  :root {
31
  --primary: #2c3e50;
32
  --secondary: #3498db;
33
+ --accent: #1abc9c;
34
  --light: #ecf0f1;
35
  --dark: #2c3e50;
36
  --success: #27ae60;
37
+ --card-shadow: 0 6px 20px rgba(0,0,0,0.08);
38
+ --transition: all 0.3s ease;
39
  }
40
 
41
  .stApp {
42
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
43
  color: #333;
44
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
45
+ max-width: 1000px;
46
+ margin: 0 auto;
47
  }
48
 
49
  .header {
50
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
51
  color: white;
52
+ padding: 2.5rem 2rem;
53
+ border-radius: 0 0 25px 25px;
54
  box-shadow: var(--card-shadow);
55
  margin-bottom: 2.5rem;
56
+ text-align: center;
57
  }
58
 
59
  .card {
60
  background: white;
61
+ border-radius: 18px;
62
+ padding: 2rem;
63
  box-shadow: var(--card-shadow);
64
+ margin-bottom: 2rem;
65
+ transition: var(--transition);
66
+ border-left: 5px solid var(--accent);
67
  }
68
 
69
  .card:hover {
70
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
 
71
  }
72
 
73
  .scenario-btn {
74
  width: 100%;
75
+ padding: 1.2rem;
76
  background: linear-gradient(135deg, var(--secondary) 0%, #2980b9 100%);
77
  color: white;
78
  border: none;
79
+ border-radius: 15px;
80
  font-weight: 600;
81
+ margin: 0.8rem 0;
82
  cursor: pointer;
83
+ transition: var(--transition);
84
  text-align: left;
85
+ padding-left: 25px;
86
+ font-size: 1.1rem;
87
+ box-shadow: 0 4px 10px rgba(0,0,0,0.1);
88
  }
89
 
90
  .scenario-btn:hover {
91
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
92
+ transform: translateY(-3px);
93
+ box-shadow: 0 8px 20px rgba(0,0,0,0.15);
94
  }
95
 
96
  .response-card {
97
  background: white;
98
  border-left: 5px solid var(--success);
99
+ border-radius: 15px;
100
+ padding: 2.5rem;
101
+ margin-top: 2.5rem;
102
  box-shadow: var(--card-shadow);
103
+ animation: fadeIn 0.8s ease;
104
  }
105
 
106
  .country-card {
107
  display: flex;
108
  align-items: center;
109
  gap: 15px;
110
+ padding: 1.5rem;
111
+ border-radius: 15px;
112
  background: white;
113
  box-shadow: var(--card-shadow);
114
+ margin-bottom: 18px;
115
  cursor: pointer;
116
+ transition: var(--transition);
117
+ border: 2px solid transparent;
118
  }
119
 
120
  .country-card:hover {
121
+ transform: translateX(8px);
122
+ box-shadow: 0 10px 25px rgba(0,0,0,0.15);
123
  }
124
 
125
  .country-card.selected {
126
+ background: linear-gradient(135deg, var(--light) 0%, #d6eaf8 100%);
127
+ border: 2px solid var(--accent);
128
+ box-shadow: 0 8px 25px rgba(0,0,0,0.12);
129
  }
130
 
131
  .footer {
132
  text-align: center;
133
+ padding: 2.5rem;
134
+ margin-top: 3.5rem;
135
  color: var(--dark);
136
+ font-size: 1rem;
137
  background: rgba(236, 240, 241, 0.7);
138
+ border-radius: 20px;
139
+ box-shadow: var(--card-shadow);
140
+ }
141
+
142
+ .spinner {
143
+ display: flex;
144
+ justify-content: center;
145
+ margin: 3rem 0;
146
  }
147
 
148
  @keyframes fadeIn {
149
+ from { opacity: 0; transform: translateY(30px); }
150
  to { opacity: 1; transform: translateY(0); }
151
  }
152
 
153
+ @keyframes pulse {
154
+ 0% { transform: scale(1); }
155
+ 50% { transform: scale(1.05); }
156
+ 100% { transform: scale(1); }
157
+ }
158
+
159
+ .pulse {
160
+ animation: pulse 2s infinite;
161
+ }
162
+
163
  @media (max-width: 768px) {
164
  .header {
165
+ padding: 1.8rem 1.2rem;
166
  }
167
 
168
  .card {
169
+ padding: 1.5rem;
170
+ }
171
+
172
+ .scenario-btn {
173
+ padding: 1rem;
174
+ font-size: 1rem;
175
  }
176
  }
177
  </style>
 
190
  "🇧🇷 Brazil": "BR",
191
  "🇿🇦 South Africa": "ZA",
192
  "🇪🇸 Spain": "ES",
193
+ "🇸🇬 Singapore": "SG"
194
  }
195
 
196
  # Common legal scenarios
 
209
  "Immigration Rights"
210
  ]
211
 
212
+ # LLM models available on Groq
213
+ MODELS = {
214
+ "Llama3-70b (Best)": "llama3-70b-8192",
215
+ "Llama3-8b (Fast)": "llama3-8b-8192",
216
+ "Mixtral-8x7b": "mixtral-8x7b-32768"
217
+ }
218
+
219
+ # Function to get rights information from Groq API
220
+ def get_legal_rights(country, scenario, model_name):
221
+ """Get legal rights information using Groq API"""
222
+ system_prompt = f"""
223
+ You are an expert legal assistant specializing in {country} law.
224
+ Provide clear, accurate information about an individual's rights in the given scenario.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
+ Guidelines:
227
+ - List 5-7 key rights as bullet points
228
+ - Start with a brief context about the legal situation
229
+ - Use plain language understandable to non-lawyers
230
+ - Include relevant legal references when appropriate
231
+ - Highlight any critical actions the person should take
232
+ - Mention any country-specific variations
233
+ - Keep response under 350 words
234
+ - Format with emojis for readability
235
+ - End with important disclaimers
236
+ """
237
 
238
+ user_prompt = f"""
239
+ Scenario: {scenario}
240
+ Country: {country}
241
 
242
+ Please provide a comprehensive list of rights for this situation in {country}.
243
+ """
 
 
244
 
245
+ try:
246
+ chat_completion = client.chat.completions.create(
247
+ messages=[
248
+ {
249
+ "role": "system",
250
+ "content": system_prompt
251
+ },
252
+ {
253
+ "role": "user",
254
+ "content": user_prompt
255
+ }
256
+ ],
257
+ model=model_name,
258
+ temperature=0.3,
259
+ max_tokens=1024,
260
+ top_p=1,
261
+ stream=False,
262
+ stop=None,
263
+ )
264
+
265
+ return chat_completion.choices[0].message.content
266
 
267
+ except Exception as e:
268
+ st.error(f"Error fetching data: {str(e)}")
269
+ return None
270
+
271
+ # Function to display response with animation
272
+ def display_response(response):
273
+ """Display the response with typing animation effect"""
274
+ message_placeholder = st.empty()
275
+ full_response = ""
276
 
277
+ # Simulate stream of response with milliseconds delay
278
+ for chunk in response.split():
279
+ full_response += chunk + " "
280
+ time.sleep(0.03)
281
+ # Add a blinking cursor to simulate typing
282
+ message_placeholder.markdown(f'<div class="response-card">{full_response}▌</div>', unsafe_allow_html=True)
283
 
284
+ # Display final message without the cursor
285
+ message_placeholder.markdown(f'<div class="response-card">{response}</div>', unsafe_allow_html=True)
286
 
287
  # Main app
288
  def main():
289
  # Header section
290
  st.markdown("""
291
  <div class="header">
292
+ <h1 style="margin:0;font-size:2.8rem;">Legal Rights Explorer Pro</h1>
293
+ <p style="margin:0;font-size:1.3rem;opacity:0.9;margin-top:12px;">Know your rights Protect your freedom</p>
294
  </div>
295
  """, unsafe_allow_html=True)
296
 
 
301
  if 'selected_scenario' not in st.session_state:
302
  st.session_state.selected_scenario = None
303
 
304
+ # Model selection at top
305
+ st.markdown("### ⚙️ AI Model Selection")
306
+ model_cols = st.columns(3)
307
+ with model_cols[0]:
308
+ selected_model = st.selectbox("Choose AI Model", list(MODELS.keys()), index=0)
309
+
310
+ with model_cols[1]:
311
+ st.markdown("### 🌎 Country")
312
+ st.caption("Selected: " + st.session_state.selected_country)
313
+
314
  # Main content columns
315
+ col1, col2 = st.columns([1, 1.2], gap="large")
316
 
317
  with col1:
318
  st.markdown("### 🌍 Select Your Country")
 
321
  # Country selection cards
322
  for country_display in COUNTRIES.keys():
323
  is_selected = st.session_state.selected_country == country_display
 
324
 
325
+ # Use button to capture click
326
+ if st.button(country_display,
327
+ key=f"btn_{country_display}",
328
+ use_container_width=True,
329
+ type="primary" if is_selected else "secondary"):
330
+ st.session_state.selected_country = country_display
331
+ st.rerun()
332
 
333
  # Country visualization
334
  st.markdown("### 📊 Global Rights Index")
 
340
  y=awareness,
341
  labels={'x': 'Country', 'y': 'Rights Awareness'},
342
  color=awareness,
343
+ color_continuous_scale='Teal',
344
  height=300
345
  )
346
  fig.update_layout(
 
351
  st.plotly_chart(fig, use_container_width=True)
352
 
353
  # Legal resources
354
+ with st.expander("📚 Legal Resources & References"):
355
  st.markdown("""
356
  - [United Nations Human Rights](https://www.ohchr.org/)
357
  - [International Justice Resource Center](https://ijrcenter.org/)
358
  - [Global Legal Information Network](https://www.loc.gov/law/help/legal-info.php)
359
  - [World Legal Information Institute](https://www.worldlii.org/)
360
+ - [Amnesty International](https://www.amnesty.org/)
361
  """)
362
 
363
  with col2:
 
377
  st.session_state.selected_scenario = scenario
378
 
379
  # Custom scenario input
380
+ custom_scenario = st.text_input("**Or describe your specific situation:**", placeholder="e.g., 'Rights during home search', 'Employee privacy rights'")
381
  if custom_scenario:
382
  st.session_state.selected_scenario = custom_scenario
383
 
384
  # Response area
385
+ st.markdown("### ⚖️ Your Legal Rights Analysis")
386
 
387
  if st.session_state.selected_scenario:
388
  country_code = COUNTRIES[st.session_state.selected_country]
389
 
390
+ with st.spinner(f"🔍 Analyzing your rights for '{st.session_state.selected_scenario}' in {country_code}..."):
391
  response = get_legal_rights(
392
  country_code,
393
+ st.session_state.selected_scenario,
394
+ MODELS[selected_model]
395
  )
396
 
397
  if response:
398
+ display_response(response)
399
  else:
400
  st.error("Failed to get response. Please try again.")
401
  else:
402
+ st.info("👆 Please select a legal scenario to see your rights information")
403
  st.image("https://images.unsplash.com/photo-1589391886645-d51941baf7fb?auto=format&fit=crop&w=600&h=400",
404
  caption="Know Your Rights, Exercise Your Freedom")
405
 
 
421
  # Footer
422
  st.markdown("""
423
  <div class="footer">
424
+ <h4>Legal Rights Explorer Pro</h4>
425
+ <p 2023 For Educational Purposes Only Not Legal Advice</p>
426
+ <p style="font-size:0.9rem;margin-top:10px;">Always consult a qualified attorney in your jurisdiction for your specific legal situation</p>
427
+ <p style="font-size:0.8rem;opacity:0.7;margin-top:15px;">Powered by Groq Cloud & Open-Source LLMs</p>
428
  </div>
429
  """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
 
431
  if __name__ == "__main__":
432
  main()