Spaces:
Sleeping
Sleeping
| 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") | |