Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Set page configuration
|
4 |
+
st.set_page_config(
|
5 |
+
page_title="Mobile Emulator",
|
6 |
+
page_icon="🌐",
|
7 |
+
layout="centered",
|
8 |
+
initial_sidebar_state="auto",
|
9 |
+
)
|
10 |
+
|
11 |
+
# CSS for mobile emulator
|
12 |
+
mobile_emulator_css = """
|
13 |
+
<style>
|
14 |
+
.mobile-emulator {
|
15 |
+
width: 360px;
|
16 |
+
height: 640px;
|
17 |
+
border: 16px black solid;
|
18 |
+
border-top-width: 60px;
|
19 |
+
border-bottom-width: 60px;
|
20 |
+
border-radius: 36px;
|
21 |
+
position: relative;
|
22 |
+
margin: auto;
|
23 |
+
overflow: hidden;
|
24 |
+
}
|
25 |
+
.mobile-emulator::before {
|
26 |
+
content: '';
|
27 |
+
display: block;
|
28 |
+
width: 60px;
|
29 |
+
height: 5px;
|
30 |
+
position: absolute;
|
31 |
+
top: -30px;
|
32 |
+
left: 50%;
|
33 |
+
transform: translate(-50%, -50%);
|
34 |
+
background: #333;
|
35 |
+
border-radius: 10px;
|
36 |
+
}
|
37 |
+
.mobile-emulator::after {
|
38 |
+
content: '';
|
39 |
+
display: block;
|
40 |
+
width: 35px;
|
41 |
+
height: 35px;
|
42 |
+
position: absolute;
|
43 |
+
left: 50%;
|
44 |
+
bottom: -65px;
|
45 |
+
transform: translate(-50%, -50%);
|
46 |
+
background: #333;
|
47 |
+
border-radius: 50%;
|
48 |
+
}
|
49 |
+
.mobile-emulator iframe {
|
50 |
+
width: 100%;
|
51 |
+
height: 100%;
|
52 |
+
border: 0;
|
53 |
+
}
|
54 |
+
</style>
|
55 |
+
"""
|
56 |
+
|
57 |
+
# HTML for mobile emulator
|
58 |
+
mobile_emulator_html = """
|
59 |
+
<div class="mobile-emulator">
|
60 |
+
<iframe src="https://www.google.com"></iframe>
|
61 |
+
</div>
|
62 |
+
"""
|
63 |
+
|
64 |
+
# JavaScript to open Chrome app
|
65 |
+
chrome_app_js = """
|
66 |
+
<script>
|
67 |
+
function openChromeApp() {
|
68 |
+
alert('Opening Chrome App...');
|
69 |
+
// You can replace the alert with actual logic to open a Chrome app
|
70 |
+
}
|
71 |
+
</script>
|
72 |
+
"""
|
73 |
+
|
74 |
+
# Streamlit App
|
75 |
+
st.title("Mobile Emulator")
|
76 |
+
|
77 |
+
# Display CSS
|
78 |
+
st.markdown(mobile_emulator_css, unsafe_allow_html=True)
|
79 |
+
|
80 |
+
# Display HTML
|
81 |
+
st.markdown(mobile_emulator_html, unsafe_allow_html=True)
|
82 |
+
|
83 |
+
# Button to open Chrome app
|
84 |
+
st.markdown(chrome_app_js, unsafe_allow_html=True)
|
85 |
+
st.button("Open Chrome App", on_click=openChromeApp)
|
86 |
+
|
87 |
+
# Run the Streamlit app
|
88 |
+
if __name__ == "__main__":
|
89 |
+
st.run()
|