Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,267 +1,112 @@
|
|
| 1 |
-
import streamlit as
|
| 2 |
-
import streamlit.components.v1 as
|
| 3 |
import requests
|
| 4 |
import os
|
| 5 |
import time
|
| 6 |
-
import streamlit as
|
| 7 |
import base64
|
| 8 |
-
from
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
os.environ
|
| 16 |
-
os.environ
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
| 35 |
-
<style>
|
| 36 |
-
body {
|
| 37 |
-
font-family: 'Dosis', sans-serif;
|
| 38 |
-
}
|
| 39 |
-
h1, h2, h3 {
|
| 40 |
-
font-family: 'Amatic SC', cursive;
|
| 41 |
-
}
|
| 42 |
-
.calculator button {
|
| 43 |
-
width: 100%;
|
| 44 |
-
padding: 20px;
|
| 45 |
-
font-size: 24px;
|
| 46 |
-
margin: 5px;
|
| 47 |
-
}
|
| 48 |
-
</style>
|
| 49 |
-
''', unsafe_allow_html=True)
|
| 50 |
-
|
| 51 |
-
# Title Section
|
| 52 |
-
st.markdown('<h1 class="display-4 text-center">My Streamlit Application</h1><p class="lead text-center">Integrating Streamlit with Bootstrap Carousel</p>', unsafe_allow_html=True)
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
left, ttyx82e85F8B2OkaP4, VOuZaTac8jFl8aMD45yk = st.columns([3,3,3])
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
with left:
|
| 60 |
-
# Carousel Structure
|
| 61 |
-
st.markdown('''<h3><i class="fa fa-calculator"></i> Calculator</h3>''', unsafe_allow_html=True)
|
| 62 |
-
|
| 63 |
-
# Box 1: Calculator
|
| 64 |
-
# Define the calculator layout
|
| 65 |
-
HSW8Jts9dbEpl = [
|
| 66 |
-
['7', '8', '9', '/'],
|
| 67 |
-
['4', '5', '6', '\*'],
|
| 68 |
-
['1', '2', '3', '\-'],
|
| 69 |
-
['C', '0', '.', '\+'],
|
| 70 |
-
['=']
|
| 71 |
-
]
|
| 72 |
-
|
| 73 |
-
# To store the calculation input
|
| 74 |
-
if 'calc_input' not in st.session_state:
|
| 75 |
-
st.session_state.calc_input = ""
|
| 76 |
-
|
| 77 |
-
# Custom calculation function
|
| 78 |
-
def lpSPz6WSDckqH_Qvo3(jh0OYNYmJ1SvgoAABS):
|
| 79 |
-
jh0OYNYmJ1SvgoAABS = expression.replace("\\","")
|
| 80 |
try:
|
| 81 |
-
|
| 82 |
-
return
|
| 83 |
except ZeroDivisionError:
|
| 84 |
-
return
|
| 85 |
except Exception:
|
| 86 |
-
return
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
elif uQVUfSGN3W7vwZLF4 == 'C':
|
| 96 |
-
st.session_state.calc_input = ""
|
| 97 |
else:
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
if st.button("Generate Prompt"):
|
| 116 |
-
# Making the API request
|
| 117 |
-
PPDPjzR2ikXsC8a3nAy = requests.post(
|
| 118 |
-
"https://model-7wlx9oew.api.baseten.co/production/predict",
|
| 119 |
-
headers={"Authorization": f"Api-Key {api_key}"},
|
| 120 |
-
json={
|
| 121 |
-
'workflow_values': {
|
| 122 |
-
'negative_prompt': N2KeKxxVP9Vij9fYynzn,
|
| 123 |
-
'positive_prompt': T5pGjCvlkmPshKDeH,
|
| 124 |
-
'controlnet_image': bVADSXzkHIONYknYG2ku_oUv
|
| 125 |
-
}
|
| 126 |
-
}
|
| 127 |
-
)
|
| 128 |
-
|
| 129 |
-
# Display the response
|
| 130 |
-
if response.status_code == 200:
|
| 131 |
-
cLsW2CII5Lg7 = response.json().get("result")
|
| 132 |
-
if result:
|
| 133 |
-
VlZz550umoVp = result[0].get("data")
|
| 134 |
-
if image_data:
|
| 135 |
-
# Decode the base64 image data
|
| 136 |
-
Wc1Or0QqEY = base64.b64decode(bVADSXzkHIOmage_data)
|
| 137 |
-
# Display the image in Streamlit
|
| 138 |
-
st.image(bVADSXzkHIOmage, caption="Generated Image", use_column_width=True)
|
| 139 |
else:
|
| 140 |
-
|
| 141 |
else:
|
| 142 |
-
|
| 143 |
else:
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
# start_prompt="Start recording",
|
| 155 |
-
# stop_prompt="Stop recording",
|
| 156 |
-
# just_once=False,
|
| 157 |
-
# use_container_width=False,
|
| 158 |
-
# callback=None,
|
| 159 |
-
# key="mic_recorder"
|
| 160 |
-
# )
|
| 161 |
-
|
| 162 |
-
# #uploaded_file = st.file_uploader("Or upload an audio file", type=["mp3", "wav", "flac", "aac"])
|
| 163 |
-
# if st.button("Transcribe"):
|
| 164 |
-
# if audio and "bytes" in audio:
|
| 165 |
-
# st.success("Recording detected. Transcribing your recording...")
|
| 166 |
-
# with open("temp_recording.wav", "wb") as f:
|
| 167 |
-
# f.write(audio["bytes"])
|
| 168 |
-
# with st.spinner("Transcribing..."):
|
| 169 |
-
# #transcription = transcribe("temp_recording.wav")
|
| 170 |
-
# #need to send the data here
|
| 171 |
-
# transcription = "Under Process"
|
| 172 |
-
# print("")
|
| 173 |
-
# st.text_area("Transcription", transcription, height=200)
|
| 174 |
-
# else:
|
| 175 |
-
# st.error("Please record audio or upload a file to transcribe.")
|
| 176 |
-
with right:
|
| 177 |
-
|
| 178 |
-
st.markdown('''<h3><i class="fa fa-pencil"></i> Chat with Mistral</h3>''', unsafe_allow_html=True)
|
| 179 |
-
# Box 4: Form 3
|
| 180 |
-
hoaAbkzFXMsp = st.text_input("Enter Prompt", key="prompt3", value="Why is Sky Blue?")
|
| 181 |
-
#image_url3 = st.text_input("Enter Image URL", key="image_url3")
|
| 182 |
-
if st.button("Submit", key="submit3"):
|
| 183 |
-
f7kC2mPqLDD70SmU = {"prompt": hoaAbkzFXMsp}
|
| 184 |
-
nkfeldxdGrO = {
|
| 185 |
-
"Authorization": f"Api-Key {BASETEN_KEY}"
|
| 186 |
-
}
|
| 187 |
-
PPDPjzR2ikXsC8a3nAy = requests.post(f"{BASETEN_API}", nkfeldxdGrO=headers, json=payload)
|
| 188 |
-
if response.status_code == 200:
|
| 189 |
-
st.write(f"**Response:** {response.json()}")
|
| 190 |
else:
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
{
|
| 222 |
-
"text": {
|
| 223 |
-
"content": xY5paFF61LV
|
| 224 |
-
}
|
| 225 |
-
}
|
| 226 |
-
]
|
| 227 |
-
}
|
| 228 |
-
}
|
| 229 |
-
notion.pages.create(parent={"database_id": hhGHi5tBjlbyAD3L51}, properties=new_page)
|
| 230 |
-
|
| 231 |
-
# Add data to Notion when form is submitted
|
| 232 |
-
if submit_button:
|
| 233 |
-
KqjV11meIo35Yp(hGJL8_D8Cp3dEh0g, qLAC0GCmFYkMr_Vkmt, xY5paFF61LV)
|
| 234 |
-
st.success("Data submitted to Notion!")
|
| 235 |
-
|
| 236 |
-
# Function to retrieve data from Notion
|
| 237 |
-
def ue5H5s3M0EYEg():
|
| 238 |
-
z9o8TYM9zJ6g = notion.databases.query(hhGHi5tBjlbyAD3L51=database_id)
|
| 239 |
-
EcLSl6QgG19QA6_zwmX = []
|
| 240 |
-
for result in query_result["results"]:
|
| 241 |
-
# Safely extract the "Name" property
|
| 242 |
-
hGJL8_D8Cp3dEh0g = result["properties"]["Name"]["title"][0]["text"]["content"] if result["properties"]["Name"]["title"] else "No Name"
|
| 243 |
-
|
| 244 |
-
# Safely extract the "Age" property
|
| 245 |
-
qLAC0GCmFYkMr_Vkmt = result["properties"]["Age"]["number"] if result["properties"]["Age"]["number"] is not None else "No Age"
|
| 246 |
-
|
| 247 |
-
# Safely extract the "Location" property
|
| 248 |
-
xY5paFF61LV = result["properties"]["Location"]["rich_text"][0]["text"]["content"] if result["properties"]["Location"]["rich_text"] else "No Location"
|
| 249 |
-
|
| 250 |
-
data.append({"Name": hGJL8_D8Cp3dEh0g, "Age": qLAC0GCmFYkMr_Vkmt, "Location": xY5paFF61LV})
|
| 251 |
-
|
| 252 |
-
return pd.DataFrame(EcLSl6QgG19QA6_zwmX)
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
# Display the data in a table
|
| 256 |
-
st.subheader("Stored Data")
|
| 257 |
-
zllkdHp41kOC7GGrtVXh = ue5H5s3M0EYEg()
|
| 258 |
-
st.table(zllkdHp41kOC7GGrtVXh)
|
| 259 |
-
|
| 260 |
-
hide_default_format = """
|
| 261 |
-
<style>
|
| 262 |
-
#MainMenu {visibility: hidden; }
|
| 263 |
-
footer {visibility: hidden;}
|
| 264 |
-
header {visibility: hidden;}
|
| 265 |
-
</style>
|
| 266 |
-
"""
|
| 267 |
-
st.markdown(CsovapSjPNxQD, unsafe_allow_html=True)
|
|
|
|
| 1 |
+
import streamlit as XQhDDyy31Q
|
| 2 |
+
import streamlit.components.v1 as YRfunIOZj4a
|
| 3 |
import requests
|
| 4 |
import os
|
| 5 |
import time
|
| 6 |
+
import streamlit as XQhDDyy31Q
|
| 7 |
import base64
|
| 8 |
+
from notion_client import Client as NYxNLLxHo8y3fvlA
|
| 9 |
+
import pandas as DxKvlZwfuzR8wvP
|
| 10 |
+
PfX0GMHlLslcoyyh1Ij = 'drinktoomuchsax/whisper-small-hi'
|
| 11 |
+
fnTqln0TJgBS0M6jZ = 'en'
|
| 12 |
+
from threading import Thread as fmOGZylJOq9w
|
| 13 |
+
os.environ['COQUI_TOS_AGREED'] = '1'
|
| 14 |
+
os.environ['TRAINER_TELEMETRY'] = '0'
|
| 15 |
+
jAZtGw7fN2iyy = os.environ.get('HF_TOKEN', None)
|
| 16 |
+
dezRUB5STvu9V = os.environ.get('BASETEN_API', None)
|
| 17 |
+
B3GBXJAotmhx = os.environ.get('BASETEN_KEY', None)
|
| 18 |
+
Nnh8WdtVyOKOYftc = os.environ.get('NOTION_API_KEY', None)
|
| 19 |
+
pxSaUtMw0Lp5Pwt = os.environ.get('NOTION_DB_ID', None)
|
| 20 |
+
G2N8A2McW18RkxP = NYxNLLxHo8y3fvlA(auth=f'{Nnh8WdtVyOKOYftc}')
|
| 21 |
+
pzeL3JmsyR = f'{pxSaUtMw0Lp5Pwt}'
|
| 22 |
+
XQhDDyy31Q.set_page_config(layout='wide')
|
| 23 |
+
XQhDDyy31Q.markdown('\n <link href="https://fonts.googleapis.com/css?family=Amatic+SC:400,700|Dosis:400,500,700&subset=latin,latin-ext" rel="stylesheet">\n <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">\n <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">\n <style>\n body {\n font-family: \'Dosis\', sans-serif;\n }\n h1, h2, h3 {\n font-family: \'Amatic SC\', cursive;\n }\n .calculator button {\n width: 100%;\n padding: 20px;\n font-size: 24px;\n margin: 5px;\n }\n </style>\n', unsafe_allow_html=True)
|
| 24 |
+
XQhDDyy31Q.markdown('<h1 class="display-4 text-center">My Streamlit Application</h1><p class="lead text-center">Integrating Streamlit with Bootstrap Carousel</p>', unsafe_allow_html=True)
|
| 25 |
+
ymypjVvAasYDrsQ6ET, OzVNj4fgSPjs, ORaxFx2Hmm = XQhDDyy31Q.columns([3, 3, 3])
|
| 26 |
+
with ymypjVvAasYDrsQ6ET:
|
| 27 |
+
XQhDDyy31Q.markdown('<h3><i class="fa fa-calculator"></i> Calculator</h3>', unsafe_allow_html=True)
|
| 28 |
+
wzlaohuTkgB = [['7', '8', '9', '/'], ['4', '5', '6', '\\*'], ['1', '2', '3', '\\-'], ['C', '0', '.', '\\+'], ['=']]
|
| 29 |
+
if 'calc_input' not in XQhDDyy31Q.session_state:
|
| 30 |
+
XQhDDyy31Q.session_state.calc_input = ''
|
| 31 |
+
|
| 32 |
+
def k7YfuptnFfmoVbfy(expression):
|
| 33 |
+
sB5lRljJ0D4ubL89z = sB5lRljJ0D4ubL89z.replace('\\', '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
try:
|
| 35 |
+
OZOcILw0hmo0fAG = eval(sB5lRljJ0D4ubL89z)
|
| 36 |
+
return str(OZOcILw0hmo0fAG)
|
| 37 |
except ZeroDivisionError:
|
| 38 |
+
return 'Error: Division by zero'
|
| 39 |
except Exception:
|
| 40 |
+
return 'Error'
|
| 41 |
+
for tdivWuSlIp8 in wzlaohuTkgB:
|
| 42 |
+
ZVq0jH5BDLC9_66UcRq0 = XQhDDyy31Q.columns(len(tdivWuSlIp8))
|
| 43 |
+
for a0MpybZzlQZDUPj, XWNDh1PFKe in enumerate(tdivWuSlIp8):
|
| 44 |
+
if XWNDh1PFKe and ZVq0jH5BDLC9_66UcRq0[a0MpybZzlQZDUPj].button(XWNDh1PFKe):
|
| 45 |
+
if XWNDh1PFKe == '=':
|
| 46 |
+
XQhDDyy31Q.session_state.calc_input = k7YfuptnFfmoVbfy(XQhDDyy31Q.session_state.calc_input)
|
| 47 |
+
elif XWNDh1PFKe == 'C':
|
| 48 |
+
XQhDDyy31Q.session_state.calc_input = ''
|
|
|
|
|
|
|
| 49 |
else:
|
| 50 |
+
XQhDDyy31Q.session_state.calc_input += XWNDh1PFKe.replace('\\', '')
|
| 51 |
+
XQhDDyy31Q.text_input('Calculation', XQhDDyy31Q.session_state.calc_input, key='display', disabled=True)
|
| 52 |
+
with OzVNj4fgSPjs:
|
| 53 |
+
XQhDDyy31Q.markdown('<h3><i class="fa fa-image"></i> Gen Image</h3>', unsafe_allow_html=True)
|
| 54 |
+
m3YH0OhGWI0AwyySIewI = f'{B3GBXJAotmhx}'
|
| 55 |
+
XNdkuz6oM12JN = XQhDDyy31Q.text_input('Negative Prompt', 'blurry, text, low quality')
|
| 56 |
+
pJtI81p3ew = XQhDDyy31Q.text_input('Positive Prompt', 'An igloo on a snowy day, 4k, hd')
|
| 57 |
+
ds13bnU7qKSBBK8G = XQhDDyy31Q.text_input('ControlNet Image URL', 'https://storage.googleapis.com/logos-bucket-01/baseten_logo.png')
|
| 58 |
+
if XQhDDyy31Q.button('Generate Prompt'):
|
| 59 |
+
hRnmRPs45lK = requests.post('https://model-7wlx9oew.api.baseten.co/production/predict', headers={'Authorization': f'Api-Key {m3YH0OhGWI0AwyySIewI}'}, json={'workflow_values': {'negative_prompt': XNdkuz6oM12JN, 'positive_prompt': pJtI81p3ew, 'controlnet_image': ds13bnU7qKSBBK8G}})
|
| 60 |
+
if hRnmRPs45lK.status_code == 200:
|
| 61 |
+
OZOcILw0hmo0fAG = hRnmRPs45lK.json().get('result')
|
| 62 |
+
if OZOcILw0hmo0fAG:
|
| 63 |
+
Pn4Uq0XlPXoxkd = OZOcILw0hmo0fAG[0].get('data')
|
| 64 |
+
if Pn4Uq0XlPXoxkd:
|
| 65 |
+
IHzZdRMxJN_5eQl = base64.b64decode(Pn4Uq0XlPXoxkd)
|
| 66 |
+
XQhDDyy31Q.image(IHzZdRMxJN_5eQl, caption='Generated Image', use_column_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
else:
|
| 68 |
+
XQhDDyy31Q.error('No image data found in the response.')
|
| 69 |
else:
|
| 70 |
+
XQhDDyy31Q.error('No result found in the response.')
|
| 71 |
else:
|
| 72 |
+
XQhDDyy31Q.error(f'Error: {hRnmRPs45lK.status_code}, {hRnmRPs45lK.text}')
|
| 73 |
+
with ORaxFx2Hmm:
|
| 74 |
+
XQhDDyy31Q.markdown('<h3><i class="fa fa-pencil"></i> Chat with Mistral</h3>', unsafe_allow_html=True)
|
| 75 |
+
rN2iq58hS_pveOG = XQhDDyy31Q.text_input('Enter Prompt', key='prompt3', value='Why is Sky Blue?')
|
| 76 |
+
if XQhDDyy31Q.button('Submit', key='submit3'):
|
| 77 |
+
IWP72nW956BQ759OzG = {'prompt': rN2iq58hS_pveOG}
|
| 78 |
+
pxXvTdG8bXXudwuvGVT3 = {'Authorization': f'Api-Key {B3GBXJAotmhx}'}
|
| 79 |
+
hRnmRPs45lK = requests.post(f'{dezRUB5STvu9V}', headers=pxXvTdG8bXXudwuvGVT3, json=IWP72nW956BQ759OzG)
|
| 80 |
+
if hRnmRPs45lK.status_code == 200:
|
| 81 |
+
XQhDDyy31Q.write(f'**Response:** {hRnmRPs45lK.json()}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
else:
|
| 83 |
+
XQhDDyy31Q.write('Failed to get a response')
|
| 84 |
+
ymypjVvAasYDrsQ6ET, nf8_MG_Umtm9CWVHoz9, ORaxFx2Hmm = XQhDDyy31Q.columns([1, 3, 1])
|
| 85 |
+
with nf8_MG_Umtm9CWVHoz9:
|
| 86 |
+
with XQhDDyy31Q.form(key='data_entry_form'):
|
| 87 |
+
q40tcJeWRZBwin = XQhDDyy31Q.text_input('Name')
|
| 88 |
+
MR94EBFaJpkVYxt0CZp = XQhDDyy31Q.number_input('Age', min_value=0)
|
| 89 |
+
WvC2V3dPsQwnoCb = XQhDDyy31Q.text_input('Location')
|
| 90 |
+
J_OnRhMhJiMemi_ = XQhDDyy31Q.form_submit_button(label='Submit')
|
| 91 |
+
|
| 92 |
+
def YAsf9MMqkpY2zS7Rp(name, age, location):
|
| 93 |
+
TYvRiD7fIp6eJ = {'Name': {'title': [{'text': {'content': q40tcJeWRZBwin}}]}, 'Age': {'number': MR94EBFaJpkVYxt0CZp}, 'Location': {'rich_text': [{'text': {'content': WvC2V3dPsQwnoCb}}]}}
|
| 94 |
+
G2N8A2McW18RkxP.pages.create(parent={'database_id': pzeL3JmsyR}, properties=TYvRiD7fIp6eJ)
|
| 95 |
+
if J_OnRhMhJiMemi_:
|
| 96 |
+
YAsf9MMqkpY2zS7Rp(q40tcJeWRZBwin, MR94EBFaJpkVYxt0CZp, WvC2V3dPsQwnoCb)
|
| 97 |
+
XQhDDyy31Q.success('Data submitted to Notion!')
|
| 98 |
+
|
| 99 |
+
def wO634JKMnkQhzuUdve87():
|
| 100 |
+
pgxfZXDbrz = G2N8A2McW18RkxP.databases.query(database_id=pzeL3JmsyR)
|
| 101 |
+
OHtTlyebJzxETZiz5q9o = []
|
| 102 |
+
for OZOcILw0hmo0fAG in pgxfZXDbrz['results']:
|
| 103 |
+
q40tcJeWRZBwin = OZOcILw0hmo0fAG['properties']['Name']['title'][0]['text']['content'] if OZOcILw0hmo0fAG['properties']['Name']['title'] else 'No Name'
|
| 104 |
+
MR94EBFaJpkVYxt0CZp = OZOcILw0hmo0fAG['properties']['Age']['number'] if OZOcILw0hmo0fAG['properties']['Age']['number'] is not None else 'No Age'
|
| 105 |
+
WvC2V3dPsQwnoCb = OZOcILw0hmo0fAG['properties']['Location']['rich_text'][0]['text']['content'] if OZOcILw0hmo0fAG['properties']['Location']['rich_text'] else 'No Location'
|
| 106 |
+
OHtTlyebJzxETZiz5q9o.append({'Name': q40tcJeWRZBwin, 'Age': MR94EBFaJpkVYxt0CZp, 'Location': WvC2V3dPsQwnoCb})
|
| 107 |
+
return DxKvlZwfuzR8wvP.DataFrame(OHtTlyebJzxETZiz5q9o)
|
| 108 |
+
XQhDDyy31Q.subheader('Stored Data')
|
| 109 |
+
dShmKN7f96aNjIg9Fyqi = wO634JKMnkQhzuUdve87()
|
| 110 |
+
XQhDDyy31Q.table(dShmKN7f96aNjIg9Fyqi)
|
| 111 |
+
CHBmeLKxbX = '\n <style>\n #MainMenu {visibility: hidden; }\n footer {visibility: hidden;}\n header {visibility: hidden;}\n </style>\n '
|
| 112 |
+
XQhDDyy31Q.markdown(CHBmeLKxbX, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|