Update app.py
Browse files
app.py
CHANGED
|
@@ -46,11 +46,28 @@ df = pd.read_sql_query(query, conn)
|
|
| 46 |
conn.close()
|
| 47 |
'''
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
data = {
|
| 50 |
"year": [1896, 1900, 1904, 2004, 2008, 2012],
|
| 51 |
"city": ["athens", "paris", "st. louis", "athens", "beijing", "london"]
|
| 52 |
}
|
| 53 |
-
table = pd.DataFrame.from_dict(data)
|
| 54 |
|
| 55 |
|
| 56 |
# Load the chatbot model
|
|
@@ -175,10 +192,10 @@ iface = gr.Interface(sqlquery, "text", "html", css="""
|
|
| 175 |
|
| 176 |
combine_interface = gr.TabbedInterface(
|
| 177 |
interface_list=[
|
| 178 |
-
|
| 179 |
-
|
| 180 |
],
|
| 181 |
-
tab_names=['
|
| 182 |
)
|
| 183 |
|
| 184 |
if __name__ == '__main__':
|
|
|
|
| 46 |
conn.close()
|
| 47 |
'''
|
| 48 |
|
| 49 |
+
# Create a sample DataFrame with 3,000 records and 20 columns
|
| 50 |
+
num_records = 3000
|
| 51 |
+
num_columns = 20
|
| 52 |
+
|
| 53 |
+
data = {
|
| 54 |
+
f"column_{i}": np.random.randint(0, 100, num_records) for i in range(num_columns)
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
# Randomize the year and city columns
|
| 58 |
+
years = list(range(2000, 2023)) # Range of years
|
| 59 |
+
cities = ["New York", "Los Angeles", "Chicago", "Houston", "Miami"] # List of cities
|
| 60 |
+
|
| 61 |
+
data["year"] = [random.choice(years) for _ in range(num_records)]
|
| 62 |
+
data["city"] = [random.choice(cities) for _ in range(num_records)]
|
| 63 |
+
|
| 64 |
+
table = pd.DataFrame(data)
|
| 65 |
+
|
| 66 |
data = {
|
| 67 |
"year": [1896, 1900, 1904, 2004, 2008, 2012],
|
| 68 |
"city": ["athens", "paris", "st. louis", "athens", "beijing", "london"]
|
| 69 |
}
|
| 70 |
+
#table = pd.DataFrame.from_dict(data)
|
| 71 |
|
| 72 |
|
| 73 |
# Load the chatbot model
|
|
|
|
| 192 |
|
| 193 |
combine_interface = gr.TabbedInterface(
|
| 194 |
interface_list=[
|
| 195 |
+
sql_interface,
|
| 196 |
+
chat_interface
|
| 197 |
],
|
| 198 |
+
tab_names=['SQL Chat' ,'Chatbot'],
|
| 199 |
)
|
| 200 |
|
| 201 |
if __name__ == '__main__':
|