praneeth232 commited on
Commit
3ef806f
·
verified ·
1 Parent(s): cc715b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -36
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
- base_dir = Path(__file__).parent
11
- html_path = base_dir / "index.html"
12
- css_path = base_dir / "styles.css"
13
- js_path = base_dir / "script.js"
14
-
15
- # Read assets
16
- html = html_path.read_text(encoding="utf-8") if html_path.exists() else "<h1>index.html not found</h1>"
17
- css = css_path.read_text(encoding="utf-8") if css_path.exists() else ""
18
- js = js_path.read_text(encoding="utf-8") if js_path.exists() else ""
19
-
20
- # Inline CSS and JS by replacing the link/script tags in index.html
21
- html_inlined = html
22
- if css:
23
- html_inlined = html_inlined.replace(
24
- '<link rel="stylesheet" href="./styles.css" />', f"<style>{css}</style>"
25
- )
26
- if js:
27
- html_inlined = html_inlined.replace(
28
- '<script src="./script.js"></script>', f"<script>{js}</script>"
29
- )
30
-
31
- # Render full HTML document inside Streamlit
32
- # Use components to allow JS execution and custom styles
33
- st.components.v1.html(html_inlined, height=900, scrolling=True)
34
-
35
- # Optional footer in Streamlit (outside the embedded app)
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")