Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,16 +30,25 @@ async def direct_regenerate(model, user_input, chatbot, character_name, characte
|
|
30 |
return "", chatbot
|
31 |
password=os.environ.get("MONGODB")
|
32 |
|
33 |
-
def init_database():
|
34 |
# uri = "mongodb://username:" + urllib.parse.quote("p@ssword") + "@127.0.0.1:27001/"
|
35 |
-
uri = "mongodb+srv://minh1228:" + urllib.parse.quote(f"{password}") + "@cluster0minp.f7ruf.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0MinP"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
client = pymongo.MongoClient(uri)
|
37 |
db = client["elo_ratings"]
|
38 |
collection = db["elo_ratings"]
|
39 |
return collection
|
40 |
|
41 |
-
|
42 |
-
|
43 |
def get_user_elo_ratings(collection):
|
44 |
rows = list(collection.find())
|
45 |
if rows:
|
|
|
30 |
return "", chatbot
|
31 |
password=os.environ.get("MONGODB")
|
32 |
|
33 |
+
#def init_database():
|
34 |
# uri = "mongodb://username:" + urllib.parse.quote("p@ssword") + "@127.0.0.1:27001/"
|
35 |
+
#uri = "mongodb+srv://minh1228:" + urllib.parse.quote(f"{password}") + "@cluster0minp.f7ruf.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0MinP"
|
36 |
+
#client = pymongo.MongoClient(uri)
|
37 |
+
#db = client["elo_ratings"]
|
38 |
+
#collection = db["elo_ratings"]
|
39 |
+
#return collection
|
40 |
+
|
41 |
+
def init_database():
|
42 |
+
password=os.environ.get("MONGODB")
|
43 |
+
username = "minh1228"
|
44 |
+
|
45 |
+
uri = f"mongodb+srv://{username}:{urllib.parse.quote(password)}@cluster0minp.f7ruf.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0MinP"
|
46 |
+
|
47 |
client = pymongo.MongoClient(uri)
|
48 |
db = client["elo_ratings"]
|
49 |
collection = db["elo_ratings"]
|
50 |
return collection
|
51 |
|
|
|
|
|
52 |
def get_user_elo_ratings(collection):
|
53 |
rows = list(collection.find())
|
54 |
if rows:
|