Spaces:
Runtime error
Runtime error
HemanthSai7
commited on
Commit
β’
53c5d8a
1
Parent(s):
ef22508
Render SVG Logo
Browse files
frontend/components/__init__.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from .authors import authors
|
2 |
from .logout import logout
|
3 |
from .login import login
|
4 |
-
from .user_greetings import user_greetings
|
|
|
|
1 |
from .authors import authors
|
2 |
from .logout import logout
|
3 |
from .login import login
|
4 |
+
from .user_greetings import user_greetings
|
5 |
+
from .logo import add_logo
|
frontend/components/login.py
CHANGED
@@ -2,7 +2,6 @@ import json
|
|
2 |
import requests
|
3 |
|
4 |
import streamlit as st
|
5 |
-
|
6 |
|
7 |
def login():
|
8 |
|
@@ -56,7 +55,7 @@ def login():
|
|
56 |
st.error("Signup Failed")
|
57 |
|
58 |
st.divider()
|
59 |
-
st.subheader(":rainbow[Our Prototype in Action π¬
|
60 |
with st.expander("Demo video π¬",expanded=True):
|
61 |
st.video("frontend/images/Showcase.mp4")
|
62 |
|
|
|
2 |
import requests
|
3 |
|
4 |
import streamlit as st
|
|
|
5 |
|
6 |
def login():
|
7 |
|
|
|
55 |
st.error("Signup Failed")
|
56 |
|
57 |
st.divider()
|
58 |
+
st.subheader(":rainbow[Our Prototype in Action ]π¬")
|
59 |
with st.expander("Demo video π¬",expanded=True):
|
60 |
st.video("frontend/images/Showcase.mp4")
|
61 |
|
frontend/components/logo.py
CHANGED
@@ -1,15 +1,21 @@
|
|
1 |
import streamlit as st
|
2 |
|
|
|
3 |
import base64
|
4 |
import validators
|
5 |
from pathlib import Path
|
6 |
|
7 |
-
def add_logo(logo_url: str, height: int =
|
8 |
|
9 |
-
if
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
else:
|
12 |
-
logo = f
|
13 |
|
14 |
st.markdown(
|
15 |
f"""
|
@@ -17,11 +23,34 @@ def add_logo(logo_url: str, height: int = 120):
|
|
17 |
[data-testid="stSidebarNav"] {{
|
18 |
background-image: {logo};
|
19 |
background-repeat: no-repeat;
|
20 |
-
background-
|
21 |
-
|
22 |
-
background-position: 20px 20px
|
23 |
}}
|
24 |
</style>
|
25 |
""",
|
26 |
unsafe_allow_html=True,
|
27 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
import re
|
4 |
import base64
|
5 |
import validators
|
6 |
from pathlib import Path
|
7 |
|
8 |
+
def add_logo(logo_url: str, height: int = 100, svg=False):
|
9 |
|
10 |
+
if svg:
|
11 |
+
svg_logo = read_svg(logo_url)
|
12 |
+
b64 = base64.b64encode(svg_logo.encode("utf-8")).decode("utf-8")
|
13 |
+
logo = f'url("data:image/svg+xml;base64,{b64}")'
|
14 |
+
|
15 |
+
elif validators.url(logo_url):
|
16 |
+
logo = f'url({logo_url})'
|
17 |
else:
|
18 |
+
logo = f'url("data:image/png;base64,{base64.b64encode(Path(logo_url).read_bytes()).decode()}")'
|
19 |
|
20 |
st.markdown(
|
21 |
f"""
|
|
|
23 |
[data-testid="stSidebarNav"] {{
|
24 |
background-image: {logo};
|
25 |
background-repeat: no-repeat;
|
26 |
+
background-position: center top; /* Center the logo at the top */
|
27 |
+
background-size: auto {height}px; /* Set the logo height */
|
|
|
28 |
}}
|
29 |
</style>
|
30 |
""",
|
31 |
unsafe_allow_html=True,
|
32 |
+
)
|
33 |
+
|
34 |
+
def read_svg(path_svg):
|
35 |
+
try:
|
36 |
+
with open(path_svg, "r") as file:
|
37 |
+
svg_logo = file.read().splitlines()
|
38 |
+
_maped_list = map(str, svg_logo)
|
39 |
+
svg_logo = "".join(_maped_list)
|
40 |
+
temp_svg_logo = re.findall("<svg.*</svg>", svg_logo, flags=re.IGNORECASE)
|
41 |
+
svg_logo = temp_svg_logo[0]
|
42 |
+
except:
|
43 |
+
svg_logo = '<svg xmlns="http://www.w3.org/2000/svg" width="150px" height="1px" viewBox="0 0 150 1"></svg>'
|
44 |
+
return svg_logo
|
45 |
+
|
46 |
+
def render_svg(svg):
|
47 |
+
b64 = base64.b64encode(svg.encode("utf-8")).decode("utf-8")
|
48 |
+
html = (
|
49 |
+
r"""
|
50 |
+
<div align="center">
|
51 |
+
<img src="data:image/svg+xml;base64,%s" alt="Techdocs Logo" style="width: 60em;"/>
|
52 |
+
</div>
|
53 |
+
"""
|
54 |
+
% b64
|
55 |
+
)
|
56 |
+
st.markdown(html, unsafe_allow_html=True)
|
frontend/images/techdocslogo.svg
ADDED
frontend/pages/2_π_Instructions.py
CHANGED
@@ -5,15 +5,16 @@ from layouts.mainlayout import mainlayout
|
|
5 |
|
6 |
@mainlayout
|
7 |
def instructions():
|
|
|
8 |
with open("frontend/content/installation.md", "r",encoding='utf-8') as f:
|
9 |
instructions = f.read()
|
10 |
|
11 |
-
with open("
|
12 |
working = f.read()
|
13 |
|
14 |
|
15 |
st.markdown("### π :rainbow[Using Techdocs via the CLI]")
|
16 |
-
st.info("Please use the CLI to generate the documentation for your project. The Streamlit app is just a demo to give the user an idea of the project.")
|
17 |
|
18 |
with st.expander("βοΈ Installation and setup"):
|
19 |
st.markdown(instructions)
|
|
|
5 |
|
6 |
@mainlayout
|
7 |
def instructions():
|
8 |
+
|
9 |
with open("frontend/content/installation.md", "r",encoding='utf-8') as f:
|
10 |
instructions = f.read()
|
11 |
|
12 |
+
with open("content/working.md", "r",encoding='utf-8') as f:
|
13 |
working = f.read()
|
14 |
|
15 |
|
16 |
st.markdown("### π :rainbow[Using Techdocs via the CLI]")
|
17 |
+
st.info("Please use the CLI to generate the documentation for your project. The Streamlit app is just a demo to give the user an idea of the project.")
|
18 |
|
19 |
with st.expander("βοΈ Installation and setup"):
|
20 |
st.markdown(instructions)
|