caustino commited on
Commit
ef7beb0
Β·
verified Β·
1 Parent(s): 6661f53

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +151 -56
index.html CHANGED
@@ -1,58 +1,153 @@
 
1
 
2
- <!DOCTYPE html>
3
- <html lang="en" class="dark">
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>SSDI Case Prep Assistant</title>
8
- <script src="https://cdn.tailwindcss.com"></script>
9
- <link rel="preconnect" href="https://fonts.googleapis.com">
10
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lexend:wght@400;500;600;700&display=swap" rel="stylesheet">
12
- <script>
13
- tailwind.config = {
14
- darkMode: 'class',
15
- theme: {
16
- extend: {
17
- fontFamily: {
18
- sans: ['Inter', 'sans-serif'],
19
- display: ['Lexend', 'sans-serif'],
20
- },
21
- colors: {
22
- 'brand-primary': '#4F46E5',
23
- 'brand-secondary': '#7C3AED',
24
- 'gray': {
25
- 50: '#F9FAFB',
26
- 100: '#F3F4F6',
27
- 200: '#E5E7EB',
28
- 300: '#D1D5DB',
29
- 400: '#9CA3AF',
30
- 500: '#6B7280',
31
- 600: '#4B5563',
32
- 700: '#374151',
33
- 800: '#1F2937',
34
- 900: '#111827',
35
- 950: '#030712'
36
- }
37
- }
38
- }
39
- }
40
- }
41
- </script>
42
- <script type="importmap">
43
- {
44
- "imports": {
45
- "react": "https://esm.sh/react@^19.1.1",
46
- "react-dom/": "https://esm.sh/react-dom@^19.1.1/",
47
- "react/": "https://esm.sh/react@^19.1.1/",
48
- "@google/genai": "https://esm.sh/@google/genai@^1.14.0"
49
- }
 
 
 
 
 
 
 
 
50
  }
51
- </script>
52
- <link rel="stylesheet" href="/index.css">
53
- </head>
54
- <body class="bg-gray-950 text-gray-100 font-sans">
55
- <div id="root"></div>
56
- <script type="module" src="/index.tsx"></script>
57
- </body>
58
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
 
3
+ import gradio as gr
4
+ import pandas as pd
5
+ import requests
6
+ from bs4 import BeautifulSoup
7
+ from transformers import pipeline
8
+
9
+ # --- Backend Functions ---
10
+
11
+ # 1. Function for the WCAG Checker Tab
12
+ def check_accessibility(url):
13
+ """
14
+ Performs a very basic accessibility check on a given URL.
15
+ This is a simplified example.
16
+ """
17
+ if not url.startswith('http'):
18
+ url = 'https://' + url
19
+ try:
20
+ response = requests.get(url, timeout=10)
21
+ soup = BeautifulSoup(response.content, 'html.parser')
22
+
23
+ results = []
24
+ # Check 1: Document language
25
+ if soup.html and soup.html.get('lang'):
26
+ results.append("βœ… HTML 'lang' attribute is present.")
27
+ else:
28
+ results.append("❌ HTML 'lang' attribute is missing. This is important for screen readers.")
29
+
30
+ # Check 2: Image alt text
31
+ images_without_alt = [img for img in soup.find_all('img') if not img.get('alt', '').strip()]
32
+ if not images_without_alt:
33
+ results.append("βœ… All <img> tags seem to have 'alt' attributes.")
34
+ else:
35
+ results.append(f"❌ Found {len(images_without_alt)} <img> tags missing descriptive 'alt' text.")
36
+
37
+ # Check 3: Page Title
38
+ if soup.title and soup.title.string:
39
+ results.append(f"βœ… Page has a title: '{soup.title.string.strip()}'")
40
+ else:
41
+ results.append("❌ Page is missing a <title> tag.")
42
+
43
+ return "\n".join(results)
44
+
45
+ except requests.RequestException as e:
46
+ return f"Error: Could not fetch the URL. Please check the address. Details: {e}"
47
+ except Exception as e:
48
+ return f"An unexpected error occurred: {e}"
49
+
50
+ # 2. Functions for the Data Explorer Tab
51
+ # Let's create some sample data to represent your projects.
52
+ # In a real-world scenario, you would upload these as CSV files to your Space.
53
+
54
+ # Mock Data for 'ssa-death-stats'
55
+ ssa_data = {
56
+ 'Year': [2020, 2021, 2022],
57
+ 'Total Deaths (Millions)': [3.3, 3.4, 3.2],
58
+ 'Cause': ['Various', 'Various', 'Various']
59
  }
60
+ df_ssa = pd.DataFrame(ssa_data)
61
+
62
+ # Mock Data for 'add-ssdi'
63
+ add_ssdi_data = {
64
+ 'Fiscal Year': [2021, 2022],
65
+ 'Applications (Thousands)': [1950, 1870],
66
+ 'Initial Claims with ADD Diagnosis': [78000, 81000]
67
+ }
68
+ df_add_ssdi = pd.DataFrame(add_ssdi_data)
69
+
70
+ datasets = {
71
+ "SSA Death Statistics": df_ssa,
72
+ "ADD & SSDI Claims": df_add_ssdi,
73
+ }
74
+
75
+ def get_dataset(dataset_name):
76
+ """Returns the selected pandas DataFrame."""
77
+ return datasets.get(dataset_name, pd.DataFrame())
78
+
79
+ # 3. Function for the AI Chat Tab
80
+ # Using a simple conversational pipeline from Hugging Face
81
+ chatbot = pipeline("conversational", model="microsoft/DialoGPT-medium")
82
+
83
+ def chat_with_ai(message, history):
84
+ """
85
+ Takes user message and conversation history, returns AI response.
86
+ """
87
+ history = history or []
88
+ response = chatbot(message, history)
89
+ # The pipeline returns a Conversation object, we need to extract the response
90
+ # This part might need adjustment based on the exact pipeline version
91
+ if hasattr(response, 'generated_responses'):
92
+ # For newer versions
93
+ new_response = response.generated_responses[-1]
94
+ else:
95
+ # Fallback for older structures
96
+ new_response = response.conversation_history[-1]
97
+
98
+ history.append((message, new_response))
99
+ return "", history
100
+
101
+
102
+ # --- Gradio UI ---
103
+
104
+ with gr.Blocks(theme=gr.themes.Soft(), css="footer {visibility: hidden}") as demo:
105
+ gr.Markdown("# πŸ€– Consolidated AI & Data Hub for Disability Justice")
106
+ gr.Markdown("An integrated platform combining accessibility tools, data insights, and AI assistance.")
107
+
108
+ with gr.Tab("🏠 Home"):
109
+ gr.Markdown(
110
+ """
111
+ ## Welcome!
112
+ This application brings together several tools and datasets focused on accessibility and disability justice.
113
+
114
+ Navigate through the tabs to explore:
115
+ - **WCAG Checker:** A simple tool to analyze web accessibility.
116
+ - **Disability Data Explorer:** View data related to Social Security and disability claims.
117
+ - **AI for Disability Justice:** An AI assistant to answer your questions.
118
+
119
+ *This is a demonstration project created by `caustino`.*
120
+ """
121
+ )
122
+
123
+ with gr.Tab("β™Ώ WCAG Checker"):
124
+ gr.Markdown("### Basic Web Accessibility (WCAG) Checker")
125
+ gr.Markdown("Enter a website URL to perform a few basic accessibility checks.")
126
+ with gr.Row():
127
+ url_input = gr.Textbox(label="Website URL", placeholder="e.g., example.com")
128
+ check_button = gr.Button("Analyze Site", variant="primary")
129
+ output_text = gr.Textbox(label="Analysis Results", lines=8, interactive=False)
130
+
131
+ check_button.click(fn=check_accessibility, inputs=url_input, outputs=output_text)
132
+
133
+ with gr.Tab("πŸ“Š Disability Data Explorer"):
134
+ gr.Markdown("### Explore Disability-Related Datasets")
135
+ gr.Markdown("Select a dataset from the dropdown to view its contents.")
136
+ dataset_dropdown = gr.Dropdown(choices=list(datasets.keys()), label="Select Dataset")
137
+ data_frame_output = gr.DataFrame(label="Dataset")
138
+
139
+ dataset_dropdown.change(fn=get_dataset, inputs=dataset_dropdown, outputs=data_frame_output)
140
+
141
+ with gr.Tab("πŸ’¬ AI for Disability Justice"):
142
+ gr.Markdown("### AI Assistant")
143
+ gr.Markdown("Ask questions about disability rights, accessibility, or the data presented in this hub.")
144
+ chatbot_ui = gr.Chatbot(label="Conversation")
145
+ msg_input = gr.Textbox(label="Your Message", placeholder="Type your question here and press Enter...")
146
+ clear_button = gr.Button("Clear Chat")
147
+
148
+ msg_input.submit(fn=chat_with_ai, inputs=[msg_input, chatbot_ui], outputs=[msg_input, chatbot_ui])
149
+ clear_button.click(lambda: None, None, chatbot_ui, queue=False)
150
+
151
+
152
+ # Launch the application
153
+ demo.launch()