Somnath3570 commited on
Commit
1be7f3c
·
verified ·
1 Parent(s): 56356ef

create app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit.components.v1 as components
2
+ import streamlit as st
3
+
4
+ # Set the page config (optional)
5
+ st.set_page_config(page_title="Dark Mode Website with Spline Embed", layout="wide")
6
+
7
+ # Embed your HTML file
8
+ html_code = """
9
+ <html><head><base href="https://somnath.com/"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Dark Mode Website with Spline Embed</title><style>
10
+ body, html {
11
+ margin: 0;
12
+ padding: 0;
13
+ font-family: Arial, sans-serif;
14
+ background-color: #25272c;
15
+ color: #ffffff;
16
+ height: 100%;
17
+ overflow: hidden;
18
+ }
19
+ .container {
20
+ position: relative;
21
+ width: 100%;
22
+ height: 100vh;
23
+ overflow: hidden;
24
+ }
25
+ .spline-container {
26
+ position: absolute;
27
+ top: 0;
28
+ left: 0;
29
+ width: 100%;
30
+ height: 100vh;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="container">
36
+ <div class="spline-container">
37
+ <script type="module" src="https://unpkg.com/@splinetool/[email protected]/build/spline-viewer.js"></script>
38
+ <spline-viewer url="https://prod.spline.design/9zdGaKbmeUwyMVbk/scene.splinecode">
39
+ <img src="https://somnath.com/spline-preview.png" alt="3D interactive scene with geometric shapes and vibrant colors" width="100%" height="100%" style="width: 100%; height: 100%; object-fit: cover;">
40
+ </spline-viewer>
41
+ </div>
42
+ </div>
43
+
44
+ <script>
45
+ document.addEventListener('DOMContentLoaded', (event) => {
46
+ const splineViewer = document.querySelector('spline-viewer');
47
+ splineViewer.addEventListener('load', () => {
48
+ console.log('Spline scene loaded successfully');
49
+ });
50
+ splineViewer.addEventListener('error', (error) => {
51
+ console.error('Error loading Spline scene:', error);
52
+ });
53
+ });
54
+ </script>
55
+ </body></html>
56
+ """
57
+ # Render the HTML code using Streamlit's components
58
+ components.html(html_code, height=800)