daniel-saed commited on
Commit
e16120f
·
verified ·
1 Parent(s): 51705db

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +145 -146
streamlit_app.py CHANGED
@@ -1,146 +1,145 @@
1
- #streamlit run your_script.py
2
- import streamlit as st
3
- import os
4
- import sys
5
-
6
- from pathlib import Path
7
-
8
- st.set_page_config(
9
- page_title="F1 Video Analysis Platform",
10
- page_icon="🏎️",
11
- initial_sidebar_state="expanded",
12
- layout="wide"
13
- )
14
- from utils.helper import BASE_DIR,metrics_page
15
- if "visited" not in st.session_state:
16
- st.session_state["visited"] = True
17
- try:
18
- metrics_page.update_one({"page": "inicio"}, {"$inc": {"visits": 1}})
19
- except:
20
- st.warning("MongoDB client not connected.")
21
-
22
-
23
- hide_decoration_bar_style = '''
24
- <style>
25
- header {visibility: hidden;}
26
- </style>
27
- '''
28
- logo_style = '''
29
- <style>
30
- /* Estilo para iconos de contacto - versión compacta */
31
- .contact-icons {
32
- display: flex;
33
- justify-content: center;
34
- gap: 8px;
35
- margin-top: 10px;
36
- flex-wrap: wrap;
37
- }
38
-
39
- .contact-icon {
40
- display: flex;
41
- align-items: center;
42
- padding: 6px;
43
- border-radius: 50%;
44
- background-color: rgba(255, 255, 255, 0.1);
45
- transition: all 0.3s ease;
46
- text-decoration: none;
47
- color: #ffffff;
48
- }
49
-
50
- .contact-icon:hover {
51
- background-color: rgba(255, 255, 255, 0.2);
52
- transform: translateY(-2px);
53
- }
54
-
55
- .contact-icon img {
56
- width: 16px;
57
- height: 16px;
58
- }
59
-
60
- /* Email button style */
61
- .email-button {
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- padding: 8px 15px;
66
- border-radius: 20px;
67
- background-color: rgba(255, 255, 255, 0.1);
68
- transition: all 0.3s ease;
69
- text-decoration: none;
70
- color: #ffffff;
71
- font-size: 13px;
72
- margin-top: 12px;
73
- width: 100%;
74
- }
75
-
76
- .email-button:hover {
77
- background-color: rgba(255, 255, 255, 0.2);
78
- }
79
-
80
- .email-button img {
81
- width: 16px;
82
- height: 16px;
83
- margin-right: 8px;
84
- }
85
-
86
- /* Estilo para el separador */
87
- .sidebar-separator {
88
- margin: 20px 0;
89
- border-top: 1px solid rgba(255, 255, 255, 0.1);
90
- }
91
- </style>
92
- '''
93
- #sst.markdown(hide_decoration_bar_style, unsafe_allow_html=True)logo_style
94
- st.markdown(logo_style, unsafe_allow_html=True)
95
-
96
- #st.markdown("<br>",unsafe_allow_html=True)
97
-
98
- with st.sidebar:
99
- st.markdown("<h3 style='text-align: center; color: #fff;'>Considerations</h3>", unsafe_allow_html=True)
100
- st.caption("""**Ouput Data**:""")
101
- st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>The model is trained with images from -180° to 180°, for the moment may not accurately predict angles beyond 180°. Poor or high-intensity lighting may affect data accuracy.</p>", unsafe_allow_html=True)
102
- st.caption("""**Usage**:""")
103
- st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>Free-tier server resources are limited, so the page may be slow or crash with large files. To run it locally, feel free to fork/clone the project or download the desktop app.</p>", unsafe_allow_html=True)
104
-
105
- st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>Any feedback is welcome.</p>", unsafe_allow_html=True)
106
- st.markdown("", unsafe_allow_html=True)
107
-
108
- st.markdown("<h3 style='text-align: center; color: #fff;'>Contact</h3>", unsafe_allow_html=True)
109
- # Nueva versión más compacta de los iconos
110
- contact_html = """
111
- <div class="contact-icons">
112
- <a href='https://x.com/justsaed' target="_blank" class="contact-icon" title="X">
113
- <img src="https://static.vecteezy.com/system/resources/previews/053/986/348/non_2x/x-twitter-icon-logo-symbol-free-png.png" alt="X">
114
- </a>
115
- <a href="https://github.com/danielsaed/F1-steering-angle-model" target="_blank" class="contact-icon" title="GitHub">
116
- <img src="https://cdn-icons-png.flaticon.com/512/25/25231.png" alt="GitHub">
117
- </a>
118
- </div>
119
-
120
- """
121
-
122
- st.markdown(contact_html, unsafe_allow_html=True)
123
- st.write("")
124
- st.write("")
125
- st.markdown("<p style='text-align: center; color: gray; font-size: 10px;'>For research/educational purposes only</p>", unsafe_allow_html=True)
126
-
127
- st.write("")
128
- st.write("")
129
- st.write("")
130
-
131
- st.markdown("<h3 style='text-align: center; color: #fff;'>Get Desktop App</h3>", unsafe_allow_html=True)
132
- col1,col2, col3 = st.columns([1,6,1])
133
- with col2:
134
-
135
- st.markdown("<p style='text-align: center; color: gray; font-size: 10px;'>Click Assets then download .exe</p>", unsafe_allow_html=True)
136
- st.link_button("Download", "https://github.com/danielsaed/F1-steering-angle-model/releases",type="secondary",use_container_width=True)
137
-
138
-
139
- pages = st.navigation({
140
- "Steering Angle Model": [
141
- st.Page(Path(BASE_DIR) / "navigation" / "steering-angle.py", title="Use Model"),
142
- st.Page(Path(BASE_DIR) / "navigation" / "soon.py", title="Historical Steering Data Base"),
143
- ],})
144
-
145
- pages.run()
146
-
 
1
+ #streamlit run your_script.py
2
+ import streamlit as st
3
+ import os
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ st.set_page_config(
8
+ page_title="F1 Video Analysis Platform",
9
+ page_icon="🏎️",
10
+ initial_sidebar_state="expanded",
11
+ layout="wide"
12
+ )
13
+ from utils.helper import BASE_DIR,metrics_page
14
+ if "visited" not in st.session_state:
15
+ st.session_state["visited"] = True
16
+ try:
17
+ metrics_page.update_one({"page": "inicio"}, {"$inc": {"visits": 1}})
18
+ except:
19
+ st.warning("MongoDB client not connected.")
20
+
21
+
22
+ hide_decoration_bar_style = '''
23
+ <style>
24
+ header {visibility: hidden;}
25
+ </style>
26
+ '''
27
+ logo_style = '''
28
+ <style>
29
+ /* Estilo para iconos de contacto - versión compacta */
30
+ .contact-icons {
31
+ display: flex;
32
+ justify-content: center;
33
+ gap: 8px;
34
+ margin-top: 10px;
35
+ flex-wrap: wrap;
36
+ }
37
+
38
+ .contact-icon {
39
+ display: flex;
40
+ align-items: center;
41
+ padding: 6px;
42
+ border-radius: 50%;
43
+ background-color: rgba(255, 255, 255, 0.1);
44
+ transition: all 0.3s ease;
45
+ text-decoration: none;
46
+ color: #ffffff;
47
+ }
48
+
49
+ .contact-icon:hover {
50
+ background-color: rgba(255, 255, 255, 0.2);
51
+ transform: translateY(-2px);
52
+ }
53
+
54
+ .contact-icon img {
55
+ width: 16px;
56
+ height: 16px;
57
+ }
58
+
59
+ /* Email button style */
60
+ .email-button {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ padding: 8px 15px;
65
+ border-radius: 20px;
66
+ background-color: rgba(255, 255, 255, 0.1);
67
+ transition: all 0.3s ease;
68
+ text-decoration: none;
69
+ color: #ffffff;
70
+ font-size: 13px;
71
+ margin-top: 12px;
72
+ width: 100%;
73
+ }
74
+
75
+ .email-button:hover {
76
+ background-color: rgba(255, 255, 255, 0.2);
77
+ }
78
+
79
+ .email-button img {
80
+ width: 16px;
81
+ height: 16px;
82
+ margin-right: 8px;
83
+ }
84
+
85
+ /* Estilo para el separador */
86
+ .sidebar-separator {
87
+ margin: 20px 0;
88
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
89
+ }
90
+ </style>
91
+ '''
92
+ #sst.markdown(hide_decoration_bar_style, unsafe_allow_html=True)logo_style
93
+ st.markdown(logo_style, unsafe_allow_html=True)
94
+
95
+ #st.markdown("<br>",unsafe_allow_html=True)
96
+
97
+ with st.sidebar:
98
+ st.markdown("<h3 style='text-align: center; color: #fff;'>Considerations</h3>", unsafe_allow_html=True)
99
+ st.caption("""**Ouput Data**:""")
100
+ st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>The model is trained with images from -180° to 180°, for the moment may not accurately predict angles beyond 180°. Poor or high-intensity lighting may affect data accuracy.</p>", unsafe_allow_html=True)
101
+ st.caption("""**Usage**:""")
102
+ st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>Free-tier server resources are limited, so the page may be slow or crash with large files. To run it locally, feel free to fork/clone the project or download the desktop app.</p>", unsafe_allow_html=True)
103
+
104
+ st.markdown("<p style='text-align: left; color: gray; font-size: 12px;'>Any feedback is welcome.</p>", unsafe_allow_html=True)
105
+ st.markdown("", unsafe_allow_html=True)
106
+
107
+ st.markdown("<h3 style='text-align: center; color: #fff;'>Contact</h3>", unsafe_allow_html=True)
108
+ # Nueva versión más compacta de los iconos
109
+ contact_html = """
110
+ <div class="contact-icons">
111
+ <a href='https://x.com/justsaed' target="_blank" class="contact-icon" title="X">
112
+ <img src="https://static.vecteezy.com/system/resources/previews/053/986/348/non_2x/x-twitter-icon-logo-symbol-free-png.png" alt="X">
113
+ </a>
114
+ <a href="https://github.com/danielsaed/F1-steering-angle-model" target="_blank" class="contact-icon" title="GitHub">
115
+ <img src="https://cdn-icons-png.flaticon.com/512/25/25231.png" alt="GitHub">
116
+ </a>
117
+ </div>
118
+
119
+ """
120
+
121
+ st.markdown(contact_html, unsafe_allow_html=True)
122
+ st.write("")
123
+ st.write("")
124
+ st.markdown("<p style='text-align: center; color: gray; font-size: 10px;'>For research/educational purposes only</p>", unsafe_allow_html=True)
125
+
126
+ st.write("")
127
+ st.write("")
128
+ st.write("")
129
+
130
+ st.markdown("<h3 style='text-align: center; color: #fff;'>Get Desktop App</h3>", unsafe_allow_html=True)
131
+ col1,col2, col3 = st.columns([1,6,1])
132
+ with col2:
133
+
134
+ st.markdown("<p style='text-align: center; color: gray; font-size: 10px;'>Click Assets then download .exe</p>", unsafe_allow_html=True)
135
+ st.link_button("Download", "https://github.com/danielsaed/F1-steering-angle-model/releases",type="secondary",use_container_width=True)
136
+
137
+
138
+ pages = st.navigation({
139
+ "Steering Angle Model": [
140
+ st.Page(Path(BASE_DIR) / "navigation" / "steering-angle.py", title="Use Model"),
141
+ st.Page(Path(BASE_DIR) / "navigation" / "soon.py", title="Historical Steering Data Base"),
142
+ ],})
143
+
144
+ pages.run()
145
+