Spaces:
Sleeping
Sleeping
File size: 1,131 Bytes
3ef806f |
1 2 3 4 5 6 7 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 |
import streamlit as st
from pathlib import Path
st.set_page_config(
page_title="Pinni Praneeth Kumar | Portfolio",
page_icon="🌐",
layout="wide",
)
html_path = "index.html"
css_path = "styles.css"
js_path = "script.js"
# Read assets
html = html_path.read_text(encoding="utf-8") if html_path.exists() else "<h1>index.html not found</h1>"
css = css_path.read_text(encoding="utf-8") if css_path.exists() else ""
js = js_path.read_text(encoding="utf-8") if js_path.exists() else ""
# Inline CSS and JS by replacing the link/script tags in index.html
html_inlined = html
if css:
html_inlined = html_inlined.replace(
'<link rel="stylesheet" href="./styles.css" />', f"<style>{css}</style>"
)
if js:
html_inlined = html_inlined.replace(
'<script src="./script.js"></script>', f"<script>{js}</script>"
)
# Render full HTML document inside Streamlit
# Use components to allow JS execution and custom styles
st.components.v1.html(html_inlined, height=900, scrolling=True)
# Optional footer in Streamlit (outside the embedded app)
st.caption("Hosted with Streamlit on Hugging Face Spaces")
|