Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image
|
2 |
+
import PIL.Image as Image
|
3 |
+
from streamlit_echarts import st_echarts
|
4 |
+
from st_on_hover_tabs import on_hover_tabs
|
5 |
+
import streamlit as st
|
6 |
+
st.set_page_config(layout="wide")
|
7 |
+
import os
|
8 |
+
import pandas as pd
|
9 |
+
from PIL import Image
|
10 |
+
from PIL import Image
|
11 |
+
import numpy as np
|
12 |
+
import matplotlib.pyplot as plt
|
13 |
+
import pandas as pd
|
14 |
+
import streamlit as st
|
15 |
+
import cv2
|
16 |
+
|
17 |
+
|
18 |
+
st.markdown('''
|
19 |
+
<style>
|
20 |
+
section[data-testid='stSidebar'] {
|
21 |
+
background-color: #111;
|
22 |
+
min-width: unset !important;
|
23 |
+
width: unset !important;
|
24 |
+
flex-shrink: unset !important;
|
25 |
+
}
|
26 |
+
|
27 |
+
button[kind="header"] {
|
28 |
+
background-color: transparent;
|
29 |
+
color: rgb(180, 167, 141);
|
30 |
+
}
|
31 |
+
|
32 |
+
@media (hover) {
|
33 |
+
/* header element to be removed */
|
34 |
+
header["data"-testid="stHeader"] {
|
35 |
+
display: none;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* The navigation menu specs and size */
|
39 |
+
section[data-testid='stSidebar'] > div {
|
40 |
+
height: 100%;
|
41 |
+
width: 95px;
|
42 |
+
position: relative;
|
43 |
+
z-index: 1;
|
44 |
+
top: 0;
|
45 |
+
left: 0;
|
46 |
+
background-color: #111;
|
47 |
+
overflow-x: hidden;
|
48 |
+
transition: 0.5s ease;
|
49 |
+
padding-top: 60px;
|
50 |
+
white-space: nowrap;
|
51 |
+
}
|
52 |
+
|
53 |
+
/* The navigation menu open and close on hover and size */
|
54 |
+
/* section[data-testid='stSidebar'] > div {
|
55 |
+
height: 100%;
|
56 |
+
width: 75px; /* Put some width to hover on. */
|
57 |
+
/* }
|
58 |
+
|
59 |
+
/* ON HOVER */
|
60 |
+
section[data-testid='stSidebar'] > div:hover{
|
61 |
+
width: 300px;
|
62 |
+
}
|
63 |
+
|
64 |
+
/* The button on the streamlit navigation menu - hidden */
|
65 |
+
button[kind="header"] {
|
66 |
+
display: none;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
@media (max-width: 272px) {
|
71 |
+
section["data"-testid='stSidebar'] > div {
|
72 |
+
width: 15rem;
|
73 |
+
}/.
|
74 |
+
}
|
75 |
+
</style>
|
76 |
+
''', unsafe_allow_html=True)
|
77 |
+
|
78 |
+
# Define CSS styling for centering
|
79 |
+
centered_style = """
|
80 |
+
display: flex;
|
81 |
+
justify-content: center;
|
82 |
+
"""
|
83 |
+
|
84 |
+
st.markdown(
|
85 |
+
"""
|
86 |
+
<div style='border: 2px solid #00CCCC; border-radius: 5px; padding: 10px; background-color: rgba(255, 255, 255, 0.25);'>
|
87 |
+
<h1 style='text-align: center; color: white; font-family: Arial, sans-serif; font-size: 35px;'>
|
88 |
+
❤️🩹 Diagnose and Identify Symptoms of Parkinson's Disease AI 🪫
|
89 |
+
</h1>
|
90 |
+
</div>
|
91 |
+
""", unsafe_allow_html=True)
|
92 |
+
|
93 |
+
with open("./assets/css/style.css") as f:
|
94 |
+
st.markdown(f"<style> {f.read()} </style>",unsafe_allow_html=True)
|
95 |
+
with open("./assets/webfonts/font.txt") as f:
|
96 |
+
st.markdown(f.read(),unsafe_allow_html=True)
|
97 |
+
# end def
|
98 |
+
|
99 |
+
with st.sidebar:
|
100 |
+
tabs = on_hover_tabs(tabName=['Home','Drawing','Action','History',],
|
101 |
+
iconName=['🏠','📝','🚶♂️','📃'],
|
102 |
+
styles={'navtab': {'background-color': '#111', 'color': '#818181', 'font-size': '18px',
|
103 |
+
'transition': '.3s', 'white-space': 'nowrap', 'text-transform': 'uppercase'},
|
104 |
+
'tabOptionsStyle':
|
105 |
+
{':hover :hover': {'color': 'red', 'cursor': 'pointer'}}, 'iconStyle':
|
106 |
+
{'position': 'fixed', 'left': '7.5px', 'text-align': 'left'}, 'tabStyle':
|
107 |
+
{'list-style-type': 'none', 'margin-bottom': '30px', 'padding-left': '30px'}},
|
108 |
+
key="1",default_choice=0)
|
109 |
+
st.markdown(
|
110 |
+
"""
|
111 |
+
<div style='border: 2px solid green; padding: 10px; white; margin-top: 5px; margin-buttom: 5px; margin-right: 20px; bottom: 50;'>
|
112 |
+
<h1 style='text-align: center; color: #0066CC; font-size: 100%'> แนวคิดนวัตกรรมและสิ่งประดิษฐ์ </h1>
|
113 |
+
<h1 style='text-align: center; color: #FF8000; font-size: 100%'> ราชวิทยาลัยจุฬาภรณ์ </h1>
|
114 |
+
<h1 style='text-align: center; color: white; font-size: 100%'> 🌎 KMUTT 💻 </h1>
|
115 |
+
</div>
|
116 |
+
""", unsafe_allow_html=True)
|
117 |
+
|
118 |
+
if tabs == 'Home':
|
119 |
+
st.image('./home.png',use_column_width=True)
|