DrishtiSharma commited on
Commit
aca245e
Β·
verified Β·
1 Parent(s): d325b19

Create dummy_funcs.py

Browse files
Files changed (1) hide show
  1. mylab/dummy_funcs.py +489 -0
mylab/dummy_funcs.py ADDED
@@ -0,0 +1,489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import sqlite3
4
+ import tempfile
5
+ from fpdf import FPDF
6
+ import os
7
+ import re
8
+ import json
9
+ from pathlib import Path
10
+ import plotly.express as px
11
+ from datetime import datetime, timezone
12
+ from crewai import Agent, Crew, Process, Task
13
+ from crewai.tools import tool
14
+ from langchain_groq import ChatGroq
15
+ from langchain_openai import ChatOpenAI
16
+ from langchain.schema.output import LLMResult
17
+ from langchain_community.tools.sql_database.tool import (
18
+ InfoSQLDatabaseTool,
19
+ ListSQLDatabaseTool,
20
+ QuerySQLCheckerTool,
21
+ QuerySQLDataBaseTool,
22
+ )
23
+ from langchain_community.utilities.sql_database import SQLDatabase
24
+ from datasets import load_dataset
25
+ from difflib import get_close_matches
26
+ import tempfile
27
+
28
+ st.title("SQL-RAG Using CrewAI πŸš€")
29
+ st.write("Analyze datasets using natural language queries powered by SQL and CrewAI.")
30
+
31
+ # Initialize LLM
32
+ llm = None
33
+
34
+ # Model Selection
35
+ model_choice = st.radio("Select LLM", ["GPT-4o", "llama-3.3-70b"], index=0, horizontal=True)
36
+
37
+ # API Key Validation and LLM Initialization
38
+ groq_api_key = os.getenv("GROQ_API_KEY")
39
+ openai_api_key = os.getenv("OPENAI_API_KEY")
40
+
41
+ if model_choice == "llama-3.3-70b":
42
+ if not groq_api_key:
43
+ st.error("Groq API key is missing. Please set the GROQ_API_KEY environment variable.")
44
+ llm = None
45
+ else:
46
+ llm = ChatGroq(groq_api_key=groq_api_key, model="groq/llama-3.3-70b-versatile")
47
+ elif model_choice == "GPT-4o":
48
+ if not openai_api_key:
49
+ st.error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable.")
50
+ llm = None
51
+ else:
52
+ llm = ChatOpenAI(api_key=openai_api_key, model="gpt-4o")
53
+
54
+ # Initialize session state for data persistence
55
+ if "df" not in st.session_state:
56
+ st.session_state.df = None
57
+ if "show_preview" not in st.session_state:
58
+ st.session_state.show_preview = False
59
+
60
+ # Dataset Input
61
+ input_option = st.radio("Select Dataset Input:", ["Use Hugging Face Dataset", "Upload CSV File"])
62
+
63
+ if input_option == "Use Hugging Face Dataset":
64
+ dataset_name = st.text_input("Enter Hugging Face Dataset Name:", value="Einstellung/demo-salaries")
65
+ if st.button("Load Dataset"):
66
+ try:
67
+ with st.spinner("Loading dataset..."):
68
+ dataset = load_dataset(dataset_name, split="train")
69
+ st.session_state.df = pd.DataFrame(dataset)
70
+ st.session_state.show_preview = True # Show preview after loading
71
+ st.success(f"Dataset '{dataset_name}' loaded successfully!")
72
+ except Exception as e:
73
+ st.error(f"Error: {e}")
74
+
75
+ elif input_option == "Upload CSV File":
76
+ uploaded_file = st.file_uploader("Upload CSV File:", type=["csv"])
77
+ if uploaded_file:
78
+ try:
79
+ st.session_state.df = pd.read_csv(uploaded_file)
80
+ st.session_state.show_preview = True # Show preview after loading
81
+ st.success("File uploaded successfully!")
82
+ except Exception as e:
83
+ st.error(f"Error loading file: {e}")
84
+
85
+ # Show Dataset Preview Only After Loading
86
+ if st.session_state.df is not None and st.session_state.show_preview:
87
+ st.subheader("πŸ“‚ Dataset Preview")
88
+ st.dataframe(st.session_state.df.head())
89
+
90
+ # Function to create TXT file
91
+ def create_text_report_with_viz_temp(report, conclusion, visualizations):
92
+ content = f"### Analysis Report\n\n{report}\n\n### Visualizations\n"
93
+
94
+ for i, fig in enumerate(visualizations, start=1):
95
+ fig_title = fig.layout.title.text if fig.layout.title.text else f"Visualization {i}"
96
+ x_axis = fig.layout.xaxis.title.text if fig.layout.xaxis.title.text else "X-axis"
97
+ y_axis = fig.layout.yaxis.title.text if fig.layout.yaxis.title.text else "Y-axis"
98
+
99
+ content += f"\n{i}. {fig_title}\n"
100
+ content += f" - X-axis: {x_axis}\n"
101
+ content += f" - Y-axis: {y_axis}\n"
102
+
103
+ if fig.data:
104
+ trace_types = set(trace.type for trace in fig.data)
105
+ content += f" - Chart Type(s): {', '.join(trace_types)}\n"
106
+ else:
107
+ content += " - No data available in this visualization.\n"
108
+
109
+ content += f"\n\n\n{conclusion}"
110
+
111
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".txt", mode='w', encoding='utf-8') as temp_txt:
112
+ temp_txt.write(content)
113
+ return temp_txt.name
114
+
115
+
116
+ # Function to create PDF with report text and visualizations
117
+ def create_pdf_report_with_viz(report, conclusion, visualizations):
118
+ pdf = FPDF()
119
+ pdf.set_auto_page_break(auto=True, margin=15)
120
+ pdf.add_page()
121
+ pdf.set_font("Arial", size=12)
122
+
123
+ # Title
124
+ pdf.set_font("Arial", style="B", size=18)
125
+ pdf.cell(0, 10, "πŸ“Š Analysis Report", ln=True, align="C")
126
+ pdf.ln(10)
127
+
128
+ # Report Content
129
+ pdf.set_font("Arial", style="B", size=14)
130
+ pdf.cell(0, 10, "Analysis", ln=True)
131
+ pdf.set_font("Arial", size=12)
132
+ pdf.multi_cell(0, 10, report)
133
+
134
+ pdf.ln(10)
135
+ pdf.set_font("Arial", style="B", size=14)
136
+ pdf.cell(0, 10, "Conclusion", ln=True)
137
+ pdf.set_font("Arial", size=12)
138
+ pdf.multi_cell(0, 10, conclusion)
139
+
140
+ # Add Visualizations
141
+ pdf.add_page()
142
+ pdf.set_font("Arial", style="B", size=16)
143
+ pdf.cell(0, 10, "πŸ“ˆ Visualizations", ln=True)
144
+ pdf.ln(5)
145
+
146
+ with tempfile.TemporaryDirectory() as temp_dir:
147
+ for i, fig in enumerate(visualizations, start=1):
148
+ fig_title = fig.layout.title.text if fig.layout.title.text else f"Visualization {i}"
149
+ x_axis = fig.layout.xaxis.title.text if fig.layout.xaxis.title.text else "X-axis"
150
+ y_axis = fig.layout.yaxis.title.text if fig.layout.yaxis.title.text else "Y-axis"
151
+
152
+ # Save each visualization as a PNG image
153
+ img_path = os.path.join(temp_dir, f"viz_{i}.png")
154
+ fig.write_image(img_path)
155
+
156
+ # Insert Title and Description
157
+ pdf.set_font("Arial", style="B", size=14)
158
+ pdf.multi_cell(0, 10, f"{i}. {fig_title}")
159
+ pdf.set_font("Arial", size=12)
160
+ pdf.multi_cell(0, 10, f"X-axis: {x_axis} | Y-axis: {y_axis}")
161
+ pdf.ln(3)
162
+
163
+ # Embed Visualization
164
+ pdf.image(img_path, w=170)
165
+ pdf.ln(10)
166
+
167
+ # Save PDF
168
+ temp_pdf = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
169
+ pdf.output(temp_pdf.name)
170
+
171
+ return temp_pdf
172
+
173
+ def escape_markdown(text):
174
+ # Ensure text is a string
175
+ text = str(text)
176
+ # Escape Markdown characters: *, _, `, ~
177
+ escape_chars = r"(\*|_|`|~)"
178
+ return re.sub(escape_chars, r"\\\1", text)
179
+
180
+
181
+ # Synonym mapping for flexible query understanding
182
+ COLUMN_SYNONYMS = {
183
+ "job_title": ["job title", "job role", "role", "designation", "position", "job responsibility", "occupation"],
184
+ "experience_level": ["experience level", "seniority", "experience", "career stage", "years of experience"],
185
+ "employment_type": ["employment type", "job type", "contract type", "employment status"],
186
+ "salary_in_usd": ["salary", "income", "earnings", "pay", "wage", "compensation"],
187
+ "remote_ratio": ["remote work", "work from home", "remote ratio", "remote", "telecommute"],
188
+ "company_size": ["company size", "organization size", "business size", "firm size"],
189
+ "employee_residence": ["country", "residence", "location", "employee location", "home country"],
190
+ "company_location": ["company location", "office location", "company country", "headquarters", "location", "located", "area"],
191
+ }
192
+
193
+
194
+ # Fuzzy matcher for mapping query terms to dataset columns
195
+ def fuzzy_match_columns(query):
196
+ query = query.lower()
197
+ all_synonyms = {synonym: col for col, synonyms in COLUMN_SYNONYMS.items() for synonym in synonyms}
198
+ words = query.replace("and", "").replace("vs", "").replace("by", "").split()
199
+
200
+ matched_columns = []
201
+ for word in words:
202
+ matches = get_close_matches(word, all_synonyms.keys(), n=1, cutoff=0.6)
203
+ matched_columns.extend([all_synonyms[match] for match in matches])
204
+
205
+ return list(dict.fromkeys(matched_columns))
206
+
207
+ # Ask LLM to suggest relevant columns if fuzzy matching fails
208
+ def ask_llm_for_columns(query, llm, df):
209
+ columns = ', '.join(df.columns)
210
+ prompt = f"""
211
+ Analyze this user query and suggest the most relevant dataset columns for visualization.
212
+ Query: "{query}"
213
+ Available Columns: {columns}
214
+ Respond in this JSON format:
215
+ {{
216
+ "x_axis": "column_name",
217
+ "y_axis": "column_name",
218
+ "group_by": "optional_column_name"
219
+ }}
220
+ """
221
+
222
+ response = llm.generate(prompt)
223
+ try:
224
+ suggestion = json.loads(response)
225
+ return suggestion
226
+ except json.JSONDecodeError:
227
+ st.error("⚠️ Failed to interpret AI response. Please refine your query.")
228
+ return None
229
+
230
+ # Add min, max, and average salary annotations to the chart
231
+ def add_stats_to_figure(fig, df, y_axis):
232
+ min_salary = df[y_axis].min()
233
+ max_salary = df[y_axis].max()
234
+ avg_salary = df[y_axis].mean()
235
+
236
+ fig.add_annotation(
237
+ text=f"Min: ${min_salary:,.2f} | Max: ${max_salary:,.2f} | Avg: ${avg_salary:,.2f}",
238
+ xref="paper", yref="paper",
239
+ x=0.5, y=1.1,
240
+ showarrow=False,
241
+ font=dict(size=12, color="black"),
242
+ bgcolor="rgba(255, 255, 255, 0.7)"
243
+ )
244
+ return fig
245
+
246
+ # Unified Visualization Generator with Fuzzy Matching and LLM Fallback
247
+ def generate_visual_from_query(query, df, llm=None):
248
+ try:
249
+ # Step 1: Attempt Fuzzy Matching
250
+ matched_columns = fuzzy_match_columns(query)
251
+
252
+ # Step 2: Fallback to LLM if no columns are matched
253
+ if not matched_columns and llm:
254
+ st.info("πŸ€– No match found. Asking AI for suggestions...")
255
+ suggestion = ask_llm_for_columns(query, llm, df)
256
+ if suggestion:
257
+ matched_columns = [suggestion.get("x_axis"), suggestion.get("group_by")]
258
+
259
+ # Step 3: Process Matched Columns
260
+ if len(matched_columns) >= 2:
261
+ x_axis, group_by = matched_columns[0], matched_columns[1]
262
+ elif len(matched_columns) == 1:
263
+ x_axis, group_by = matched_columns[0], None
264
+ else:
265
+ st.warning("❓ No matching columns found. Try rephrasing your query.")
266
+ return None
267
+
268
+ # Step 4: Visualization Generation
269
+
270
+ # Distribution Plot
271
+ if "distribution" in query:
272
+ fig = px.box(df, x=x_axis, y="salary_in_usd", color=group_by,
273
+ title=f"Salary Distribution by {x_axis.replace('_', ' ').title()}"
274
+ + (f" and {group_by.replace('_', ' ').title()}" if group_by else ""))
275
+ return add_stats_to_figure(fig, df, "salary_in_usd")
276
+
277
+ # Average Salary Plot
278
+ elif "average" in query or "mean" in query:
279
+ grouped_df = df.groupby([x_axis] + ([group_by] if group_by else []))["salary_in_usd"].mean().reset_index()
280
+ fig = px.bar(grouped_df, x=x_axis, y="salary_in_usd", color=group_by,
281
+ title=f"Average Salary by {x_axis.replace('_', ' ').title()}"
282
+ + (f" and {group_by.replace('_', ' ').title()}" if group_by else ""))
283
+ return add_stats_to_figure(fig, df, "salary_in_usd")
284
+
285
+ # Salary Trends Over Time
286
+ elif "trend" in query and "work_year" in df.columns:
287
+ grouped_df = df.groupby(["work_year", x_axis])["salary_in_usd"].mean().reset_index()
288
+ fig = px.line(grouped_df, x="work_year", y="salary_in_usd", color=x_axis,
289
+ title=f"Salary Trend Over Years by {x_axis.replace('_', ' ').title()}")
290
+ return add_stats_to_figure(fig, df, "salary_in_usd")
291
+
292
+ # Remote Work Impact
293
+ elif "remote" in query:
294
+ grouped_df = df.groupby(["remote_ratio"] + ([group_by] if group_by else []))["salary_in_usd"].mean().reset_index()
295
+ fig = px.bar(grouped_df, x="remote_ratio", y="salary_in_usd", color=group_by,
296
+ title="Remote Work Impact on Salary")
297
+ return add_stats_to_figure(fig, df, "salary_in_usd")
298
+
299
+ # No Specific Match
300
+ else:
301
+ st.warning("⚠️ No suitable visualization to display!")
302
+ return None
303
+
304
+ except Exception as e:
305
+ st.error(f"Error generating visualization: {e}")
306
+ return None
307
+
308
+
309
+ # SQL-RAG Analysis
310
+ if st.session_state.df is not None:
311
+ temp_dir = tempfile.TemporaryDirectory()
312
+ db_path = os.path.join(temp_dir.name, "data.db")
313
+ connection = sqlite3.connect(db_path)
314
+ st.session_state.df.to_sql("salaries", connection, if_exists="replace", index=False)
315
+ db = SQLDatabase.from_uri(f"sqlite:///{db_path}")
316
+
317
+ @tool("list_tables")
318
+ def list_tables() -> str:
319
+ """List all tables in the database."""
320
+ return ListSQLDatabaseTool(db=db).invoke("")
321
+
322
+ @tool("tables_schema")
323
+ def tables_schema(tables: str) -> str:
324
+ """Get the schema and sample rows for the specified tables."""
325
+ return InfoSQLDatabaseTool(db=db).invoke(tables)
326
+
327
+ @tool("execute_sql")
328
+ def execute_sql(sql_query: str) -> str:
329
+ """Execute a SQL query against the database and return the results."""
330
+ return QuerySQLDataBaseTool(db=db).invoke(sql_query)
331
+
332
+ @tool("check_sql")
333
+ def check_sql(sql_query: str) -> str:
334
+ """Validate the SQL query syntax and structure before execution."""
335
+ return QuerySQLCheckerTool(db=db, llm=llm).invoke({"query": sql_query})
336
+
337
+ # Agents for SQL data extraction and analysis
338
+ sql_dev = Agent(
339
+ role="Senior Database Developer",
340
+ goal="Extract data using optimized SQL queries.",
341
+ backstory="An expert in writing optimized SQL queries for complex databases.",
342
+ llm=llm,
343
+ tools=[list_tables, tables_schema, execute_sql, check_sql],
344
+ )
345
+
346
+ data_analyst = Agent(
347
+ role="Senior Data Analyst",
348
+ goal="Analyze the data and produce insights.",
349
+ backstory="A seasoned analyst who identifies trends and patterns in datasets.",
350
+ llm=llm,
351
+ )
352
+
353
+ report_writer = Agent(
354
+ role="Technical Report Writer",
355
+ goal="Write a structured report with Introduction and Key Insights. DO NOT include any Conclusion or Summary.",
356
+ backstory="Specializes in detailed analytical reports without conclusions.",
357
+ llm=llm,
358
+ )
359
+
360
+ conclusion_writer = Agent(
361
+ role="Conclusion Specialist",
362
+ goal="Summarize findings into a clear and concise 3-5 line Conclusion highlighting only the most important insights.",
363
+ backstory="An expert in crafting impactful and clear conclusions.",
364
+ llm=llm,
365
+ )
366
+
367
+ # Define tasks for report and conclusion
368
+ extract_data = Task(
369
+ description="Extract data based on the query: {query}.",
370
+ expected_output="Database results matching the query.",
371
+ agent=sql_dev,
372
+ )
373
+
374
+ analyze_data = Task(
375
+ description="Analyze the extracted data for query: {query}.",
376
+ expected_output="Key Insights and Analysis without any Introduction or Conclusion.",
377
+ agent=data_analyst,
378
+ context=[extract_data],
379
+ )
380
+
381
+ write_report = Task(
382
+ description="Write the analysis report with Introduction and Key Insights. DO NOT include any Conclusion or Summary.",
383
+ expected_output="Markdown-formatted report excluding Conclusion.",
384
+ agent=report_writer,
385
+ context=[analyze_data],
386
+ )
387
+
388
+ write_conclusion = Task(
389
+ description="Summarize the key findings in 3-5 impactful lines, highlighting the maximum, minimum, and average salaries."
390
+ "Emphasize significant insights on salary distribution and influential compensation trends for strategic decision-making.",
391
+ expected_output="Markdown-formatted Conclusion section with key insights and statistics.",
392
+ agent=conclusion_writer,
393
+ context=[analyze_data],
394
+ )
395
+
396
+
397
+
398
+ # Separate Crews for report and conclusion
399
+ crew_report = Crew(
400
+ agents=[sql_dev, data_analyst, report_writer],
401
+ tasks=[extract_data, analyze_data, write_report],
402
+ process=Process.sequential,
403
+ verbose=True,
404
+ )
405
+
406
+ crew_conclusion = Crew(
407
+ agents=[data_analyst, conclusion_writer],
408
+ tasks=[write_conclusion],
409
+ process=Process.sequential,
410
+ verbose=True,
411
+ )
412
+
413
+ # Tabs for Query Results and Visualizations
414
+ tab1, tab2 = st.tabs(["πŸ” Query Insights + Viz", "πŸ“Š Full Data Viz"])
415
+
416
+ # Query Insights + Visualization
417
+ with tab1:
418
+ query = st.text_area("Enter Query:", value="Provide insights into the salary of a Principal Data Scientist.")
419
+ if st.button("Submit Query"):
420
+ with st.spinner("Processing query..."):
421
+ # Step 1: Generate the analysis report
422
+ report_inputs = {"query": query + " Provide detailed analysis but DO NOT include Conclusion."}
423
+ report_result = crew_report.kickoff(inputs=report_inputs)
424
+
425
+ # Step 2: Generate only the concise conclusion
426
+ conclusion_inputs = {"query": query + " Provide ONLY the most important insights in 3-5 concise lines."}
427
+ conclusion_result = crew_conclusion.kickoff(inputs=conclusion_inputs)
428
+
429
+ # Step 3: Display the report
430
+ #st.markdown("### Analysis Report:")
431
+ st.markdown(report_result if report_result else "⚠️ No Report Generated.")
432
+
433
+ # Step 4: Generate Visualizations
434
+ visualizations = []
435
+
436
+ fig_salary = px.box(st.session_state.df, x="job_title", y="salary_in_usd",
437
+ title="Salary Distribution by Job Title")
438
+ visualizations.append(fig_salary)
439
+
440
+ fig_experience = px.bar(
441
+ st.session_state.df.groupby("experience_level")["salary_in_usd"].mean().reset_index(),
442
+ x="experience_level", y="salary_in_usd",
443
+ title="Average Salary by Experience Level"
444
+ )
445
+ visualizations.append(fig_experience)
446
+
447
+ fig_employment = px.box(st.session_state.df, x="employment_type", y="salary_in_usd",
448
+ title="Salary Distribution by Employment Type")
449
+ visualizations.append(fig_employment)
450
+
451
+ # Step 5: Insert Visual Insights
452
+ st.markdown("### Visual Insights")
453
+ for fig in visualizations:
454
+ st.plotly_chart(fig, use_container_width=True)
455
+
456
+ # Step 6: Display Concise Conclusion
457
+ #st.markdown("#### Conclusion")
458
+
459
+ safe_conclusion = escape_markdown(conclusion_result if conclusion_result else "⚠️ No Conclusion Generated.")
460
+ st.markdown(safe_conclusion)
461
+
462
+ # Full Data Visualization Tab
463
+ with tab2:
464
+ st.subheader("πŸ“Š Comprehensive Data Visualizations")
465
+
466
+ fig1 = px.histogram(st.session_state.df, x="job_title", title="Job Title Frequency")
467
+ st.plotly_chart(fig1)
468
+
469
+ fig2 = px.bar(
470
+ st.session_state.df.groupby("experience_level")["salary_in_usd"].mean().reset_index(),
471
+ x="experience_level", y="salary_in_usd",
472
+ title="Average Salary by Experience Level"
473
+ )
474
+ st.plotly_chart(fig2)
475
+
476
+ fig3 = px.box(st.session_state.df, x="employment_type", y="salary_in_usd",
477
+ title="Salary Distribution by Employment Type")
478
+ st.plotly_chart(fig3)
479
+
480
+ temp_dir.cleanup()
481
+ else:
482
+ st.info("Please load a dataset to proceed.")
483
+
484
+
485
+ # Sidebar Reference
486
+ with st.sidebar:
487
+ st.header("πŸ“š Reference:")
488
+ st.markdown("[SQL Agents w CrewAI & Llama 3 - Plaban Nayak](https://github.com/plaban1981/Agents/blob/main/SQL_Agents_with_CrewAI_and_Llama_3.ipynb)")
489
+