ShehryarAppsWork's picture
Update NoNavPages/Home.py
b085127 verified
import streamlit as st
import asyncio
import time
from styles import *
from app import *
import base64
# font-size:5em;
stream_text = [
"""<h1 style="color:#E0E0E0; font-size:4.5em; text-shadow: 2px 2px 8px rgba(0,0,0,0.7); font-weight: 600;">Adopt AI With Confidence</h1>""",
"""<h2 style="color:#CCCCCC; text-shadow: 1px 1px 6px rgba(0,0,0,0.6); font-weight: 400;">Ensure AI Risk Management</h2>""",
"""<h2 style="color:#B0B0B0; text-shadow: 1px 1px 6px rgba(0,0,0,0.6); font-weight: 400;">Comply With Regulations and Standards</h2>"""
]
def stream_data():
for text in stream_text:
words = text.split() # Split text into words
for word in words:
yield word + ' ' # Add space after each word
time.sleep(0.1) # Adjust delay as needed
def typewriter_animation(placeholder):
stream_output = ""
for char in stream_data():
stream_output += char
placeholder.markdown(f'<div class="stream-text">{stream_output}</div>', unsafe_allow_html=True)
#await asyncio.sleep(0.1) # Adjust speed here
def no_typewriter(placeholder):
stream_output = ""
for item in stream_text:
stream_output += item
placeholder.markdown(f'<div class="stream-text">{stream_output}</div>', unsafe_allow_html=True)
def get_svg_base64(path):
with open(path, "rb") as f:
svg_data = f.read()
return base64.b64encode(svg_data).decode("utf-8")
def home():
mainCont = st.container(height = 700,border = False)
st.markdown(mainCont_style,unsafe_allow_html=True)
Marginleft, AppCol, Marginright= st.columns([0.05,0.9,0.05])
#bordered page content
# with AppCol:
# st.markdown(pagemargin,unsafe_allow_html=True)
# st.write("<h1>HTML Headings</h1>",unsafe_allow_html=True)
# st.write("Hello World! The nature of compuation is one that requires the need to complete the fundamental theorem of line integrrals as this is one of the most important concepts of calculus 1. The power rangers are tough but i am tougher than them cuz they no on my level so hush hush little puppy hush hush")
# st.write("This is some more hello!")
# st.write("<h1>HTML Heading1</h1>",unsafe_allow_html=True)
# st.write("<h1>HTML Heading2</h1>",unsafe_allow_html=True)
# st.write("<h1>HTML Heading3</h1>",unsafe_allow_html=True)
# st.write("<h1>HTML Heading4</h1>",unsafe_allow_html=True)
# st.write("<h1>HTML Heading5</h1>",unsafe_allow_html=True)
# st.write("<h1>HTML Heading6</h1>",unsafe_allow_html=True)
#Animation
with mainCont:
Marginleft, mainContCol, Marginright = st.columns([0.15,0.7,0.15], vertical_alignment="center")
with mainContCol:
placeholder = st.empty()
if st.session_state.firsttime == 0:
st.session_state.firsttime = 1
typewriter_animation(placeholder)
else:
no_typewriter(placeholder)
svg_path = "LOGO/LOGO1.svg"
svg_base64 = get_svg_base64(svg_path)
st.markdown(f"""
<div style='text-align: center;'>
<img src='data:image/svg+xml;base64,{svg_base64}'
style='max-width: 75%; height: auto; transform: translateX(-1rem);' />
</div>
""", unsafe_allow_html=True)