Spaces:
Sleeping
Sleeping
revert
Browse files
app.py
CHANGED
@@ -8,94 +8,58 @@ from tools.final_answer import FinalAnswerTool
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
import sqlite3
|
11 |
-
import
|
12 |
-
|
13 |
-
# Sample data for generating employees
|
14 |
-
first_names = [
|
15 |
-
"John",
|
16 |
-
"Emma",
|
17 |
-
"Michael",
|
18 |
-
"Sarah",
|
19 |
-
"William",
|
20 |
-
"Olivia",
|
21 |
-
"James",
|
22 |
-
"Ava",
|
23 |
-
"Robert",
|
24 |
-
"Isabella",
|
25 |
-
]
|
26 |
-
last_names = [
|
27 |
-
"Smith",
|
28 |
-
"Johnson",
|
29 |
-
"Williams",
|
30 |
-
"Brown",
|
31 |
-
"Jones",
|
32 |
-
"Davis",
|
33 |
-
"Miller",
|
34 |
-
"Wilson",
|
35 |
-
"Moore",
|
36 |
-
"Taylor",
|
37 |
-
]
|
38 |
-
job_titles = [
|
39 |
-
"Software Engineer",
|
40 |
-
"Data Analyst",
|
41 |
-
"Marketing Manager",
|
42 |
-
"Sales Representative",
|
43 |
-
"Product Designer",
|
44 |
-
]
|
45 |
-
departments = ["Engineering", "Finance", "Marketing", "Sales", "Operations"]
|
46 |
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
# Create and populate the database
|
97 |
-
create_employee_table()
|
98 |
|
|
|
|
|
99 |
|
100 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
101 |
@tool
|
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
import sqlite3
|
11 |
+
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
+
# Connect to SQLite database. It will be created if it doesn't exist
|
15 |
+
conn = sqlite3.connect('employee_database.db')
|
16 |
+
cursor = conn.cursor()
|
17 |
|
18 |
+
# Create employees table with basic columns
|
19 |
+
cursor.execute('''
|
20 |
+
CREATE TABLE IF NOT EXISTS employees (
|
21 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
22 |
+
first_name TEXT NOT NULL,
|
23 |
+
last_name TEXT NOT NULL,
|
24 |
+
job_title TEXT NOT NULL
|
25 |
+
)
|
26 |
+
''')
|
27 |
+
|
28 |
+
# Commit the transaction
|
29 |
+
conn.commit()
|
30 |
+
|
31 |
+
# Sample data for employees
|
32 |
+
employees_data = [
|
33 |
+
('John', 'Smith', 'Software Engineer'),
|
34 |
+
('Sarah', 'Johnson', 'Marketing Manager'),
|
35 |
+
('Michael', 'Brown', 'Data Scientist'),
|
36 |
+
('Emma', 'Wilson', 'Product Designer'),
|
37 |
+
('William', 'Davis', 'DevOps Engineer'),
|
38 |
+
('Olivia', 'Miller', 'UX Researcher'),
|
39 |
+
('James', 'Wilson', 'Backend Developer'),
|
40 |
+
('Jessica', 'Moore', 'Project Manager'),
|
41 |
+
('Robert', 'Taylor', 'Frontend Developer'),
|
42 |
+
('Lisa', 'Anderson', 'Quality Assurance'),
|
43 |
+
('Richard', 'Thomas', 'Technical Writer'),
|
44 |
+
('Amy', 'Jackson', 'Business Analyst'),
|
45 |
+
('Charles', 'White', 'Database Administrator'),
|
46 |
+
('Elizabeth', 'Harris', 'Customer Support'),
|
47 |
+
('Thomas', 'Martin', 'Network Engineer'),
|
48 |
+
('Jennifer', 'Thompson', 'HR Specialist'),
|
49 |
+
('Donald', 'Walker', 'Security Specialist'),
|
50 |
+
('Margaret', 'Young', 'Content Manager'),
|
51 |
+
('Ronald', 'Allen', 'Sales Representative'),
|
52 |
+
('Susan', 'Scott', 'Financial Analyst')
|
53 |
+
]
|
54 |
+
|
55 |
+
# Insert multiple records efficiently using executemany
|
56 |
+
cursor.executemany('''
|
57 |
+
INSERT INTO employees (first_name, last_name, job_title)
|
58 |
+
VALUES (?, ?, ?)
|
59 |
+
''', employees_data)
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
# Commit the transaction
|
62 |
+
conn.commit()
|
63 |
|
64 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
65 |
@tool
|