Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,13 @@ import streamlit.components.v1 as components
|
|
34 |
from datetime import datetime
|
35 |
from streamlit_js_eval import streamlit_js_eval
|
36 |
from streamlit_pdf_viewer import pdf_viewer
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
|
40 |
st.set_page_config(layout="wide")
|
@@ -382,6 +388,17 @@ if "rerun" not in dictionary:
|
|
382 |
st.rerun()
|
383 |
if "upload_file_name" not in dictionary:
|
384 |
dictionary['upload_file_name'] = "no file"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
stroke_width = st.sidebar.slider("Stroke width: ", 1, 25, 20)
|
387 |
if drawing_mode == 'point':
|
|
|
34 |
from datetime import datetime
|
35 |
from streamlit_js_eval import streamlit_js_eval
|
36 |
from streamlit_pdf_viewer import pdf_viewer
|
37 |
+
import uuid
|
38 |
+
from pymongo.mongo_client import MongoClient
|
39 |
+
from pymongo.server_api import ServerApi
|
40 |
+
import time
|
41 |
+
def get_new_uuid():
|
42 |
+
# Generate a random UUID (UUID4) and convert it to a string
|
43 |
+
return str(uuid.uuid4())
|
44 |
|
45 |
|
46 |
st.set_page_config(layout="wide")
|
|
|
388 |
st.rerun()
|
389 |
if "upload_file_name" not in dictionary:
|
390 |
dictionary['upload_file_name'] = "no file"
|
391 |
+
if "new_id" not in dictionary:
|
392 |
+
dictionary["new_id"] = get_new_uuid()
|
393 |
+
if "client" not in dictionary:
|
394 |
+
|
395 |
+
uri = "mongodb+srv://rajstarts35325:[email protected]/?retryWrites=true&w=majority&appName=Cluster0"
|
396 |
+
dictionary['client'] = MongoClient(uri, server_api=ServerApi('1'))
|
397 |
+
try:
|
398 |
+
dictionary['client'].admin.command('ping')
|
399 |
+
print("Pinged your deployment. You successfully connected to MongoDB!")
|
400 |
+
except Exception as e:
|
401 |
+
print(e)
|
402 |
|
403 |
stroke_width = st.sidebar.slider("Stroke width: ", 1, 25, 20)
|
404 |
if drawing_mode == 'point':
|