Update main.py
Browse files
main.py
CHANGED
@@ -3,7 +3,6 @@ import json
|
|
3 |
import bcrypt
|
4 |
import pandas as pd
|
5 |
import numpy as np
|
6 |
-
import random
|
7 |
from typing import List
|
8 |
from pathlib import Path
|
9 |
|
@@ -30,7 +29,6 @@ literal_client = LiteralClient(api_key=os.getenv("LITERAL_API_KEY"))
|
|
30 |
|
31 |
from surveycaa import surveyCaa
|
32 |
|
33 |
-
id_sphinx = random.randint(100, 10000)
|
34 |
@cl.password_auth_callback
|
35 |
def auth_callback(username: str, password: str):
|
36 |
auth = json.loads(os.environ['CHAINLIT_AUTH_LOGIN'])
|
@@ -67,8 +65,8 @@ def create_agent(filename: str):
|
|
67 |
# Read the CSV file into a Pandas DataFrame.
|
68 |
if cl.user_session.get("createdb") == None:
|
69 |
df = pd.read_csv(filename)
|
70 |
-
engine = create_engine("sqlite:///sphinx" + str(
|
71 |
-
df.to_sql("sphinx" + str(
|
72 |
db = SQLDatabase(engine=engine)
|
73 |
cl.user_session.set("createdb", "OK")
|
74 |
cl.user_session.set("db", db)
|
|
|
3 |
import bcrypt
|
4 |
import pandas as pd
|
5 |
import numpy as np
|
|
|
6 |
from typing import List
|
7 |
from pathlib import Path
|
8 |
|
|
|
29 |
|
30 |
from surveycaa import surveyCaa
|
31 |
|
|
|
32 |
@cl.password_auth_callback
|
33 |
def auth_callback(username: str, password: str):
|
34 |
auth = json.loads(os.environ['CHAINLIT_AUTH_LOGIN'])
|
|
|
65 |
# Read the CSV file into a Pandas DataFrame.
|
66 |
if cl.user_session.get("createdb") == None:
|
67 |
df = pd.read_csv(filename)
|
68 |
+
engine = create_engine("sqlite:///sphinx" + str(cl.user_session.get("id")) + ".db")
|
69 |
+
df.to_sql("sphinx" + str(cl.user_session.get("id")), engine, index=False)
|
70 |
db = SQLDatabase(engine=engine)
|
71 |
cl.user_session.set("createdb", "OK")
|
72 |
cl.user_session.set("db", db)
|