Spaces:
Sleeping
Sleeping
Commit
·
47cfa38
1
Parent(s):
521767f
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,6 @@ import sqlite3
|
|
| 4 |
import numpy as np
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
-
translator = pipeline(model= "saikiranmaddukuri/chat_to_sql0.17", max_new_tokens= 100)
|
| 8 |
-
df= pd.read_csv("Car_sales.csv")
|
| 9 |
|
| 10 |
## Function to read SQL data
|
| 11 |
def read_sql_query(sql, db):
|
|
@@ -18,14 +16,22 @@ def read_sql_query(sql, db):
|
|
| 18 |
conn.close()
|
| 19 |
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
st.title("Conversational AI: Text-2-SQL")
|
| 24 |
|
| 25 |
column_info = df.dtypes.to_dict()
|
| 26 |
column_df = pd.DataFrame(column_info.items(), columns=['Column Name', 'Data Type'])
|
| 27 |
st.sidebar.table(column_df)
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
create_table_statement= "CREATE TABLE car_sales (Manufacturer text, Model text, Sales_in_thousands float, __year_resale_value float, Vehicle_type text, Price_in_thousands float, Engine_size float, Horsepower float, Wheelbase float, Width float, Length float, Curb_weight float, Fuel_capacity float, Fuel_efficiency float, Latest_Launch text, Power_perf_factor float)"
|
| 31 |
|
|
@@ -51,5 +57,6 @@ def main():
|
|
| 51 |
# Step 5: Display final output
|
| 52 |
#st.write("Final Output:", final_output)
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
import pandas as pd
|
| 6 |
|
|
|
|
|
|
|
| 7 |
|
| 8 |
## Function to read SQL data
|
| 9 |
def read_sql_query(sql, db):
|
|
|
|
| 16 |
conn.close()
|
| 17 |
|
| 18 |
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
i_pwd= st.sidebar.text_input("Enter password", type="password")
|
| 22 |
+
|
| 23 |
+
if i_pwd=='password':
|
| 24 |
+
|
| 25 |
+
translator = pipeline(model= "saikiranmaddukuri/chat_to_sql0.17", max_new_tokens= 100)
|
| 26 |
+
df= pd.read_csv("Car_sales.csv")
|
| 27 |
+
|
| 28 |
st.title("Conversational AI: Text-2-SQL")
|
| 29 |
|
| 30 |
column_info = df.dtypes.to_dict()
|
| 31 |
column_df = pd.DataFrame(column_info.items(), columns=['Column Name', 'Data Type'])
|
| 32 |
st.sidebar.table(column_df)
|
| 33 |
|
| 34 |
+
|
| 35 |
|
| 36 |
create_table_statement= "CREATE TABLE car_sales (Manufacturer text, Model text, Sales_in_thousands float, __year_resale_value float, Vehicle_type text, Price_in_thousands float, Engine_size float, Horsepower float, Wheelbase float, Width float, Length float, Curb_weight float, Fuel_capacity float, Fuel_efficiency float, Latest_Launch text, Power_perf_factor float)"
|
| 37 |
|
|
|
|
| 57 |
# Step 5: Display final output
|
| 58 |
#st.write("Final Output:", final_output)
|
| 59 |
|
| 60 |
+
else:
|
| 61 |
+
st.warning("Enter correct password!")
|
| 62 |
+
|