Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,36 +1,35 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from pathlib import Path
|
| 3 |
-
|
| 4 |
-
st.set_page_config(
|
| 5 |
-
page_title="Pinni Praneeth Kumar | Portfolio",
|
| 6 |
-
page_icon="🌐",
|
| 7 |
-
layout="wide",
|
| 8 |
-
)
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
st.caption("Hosted with Streamlit on Hugging Face Spaces")
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
st.set_page_config(
|
| 5 |
+
page_title="Pinni Praneeth Kumar | Portfolio",
|
| 6 |
+
page_icon="🌐",
|
| 7 |
+
layout="wide",
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
html_path = "index.html"
|
| 11 |
+
css_path = "styles.css"
|
| 12 |
+
js_path = "script.js"
|
| 13 |
+
|
| 14 |
+
# Read assets
|
| 15 |
+
html = html_path.read_text(encoding="utf-8") if html_path.exists() else "<h1>index.html not found</h1>"
|
| 16 |
+
css = css_path.read_text(encoding="utf-8") if css_path.exists() else ""
|
| 17 |
+
js = js_path.read_text(encoding="utf-8") if js_path.exists() else ""
|
| 18 |
+
|
| 19 |
+
# Inline CSS and JS by replacing the link/script tags in index.html
|
| 20 |
+
html_inlined = html
|
| 21 |
+
if css:
|
| 22 |
+
html_inlined = html_inlined.replace(
|
| 23 |
+
'<link rel="stylesheet" href="./styles.css" />', f"<style>{css}</style>"
|
| 24 |
+
)
|
| 25 |
+
if js:
|
| 26 |
+
html_inlined = html_inlined.replace(
|
| 27 |
+
'<script src="./script.js"></script>', f"<script>{js}</script>"
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
# Render full HTML document inside Streamlit
|
| 31 |
+
# Use components to allow JS execution and custom styles
|
| 32 |
+
st.components.v1.html(html_inlined, height=900, scrolling=True)
|
| 33 |
+
|
| 34 |
+
# Optional footer in Streamlit (outside the embedded app)
|
| 35 |
+
st.caption("Hosted with Streamlit on Hugging Face Spaces")
|
|
|