osheina commited on
Commit
4ed2a8c
·
verified ·
1 Parent(s): 01171f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -124
app.py CHANGED
@@ -1,143 +1,117 @@
1
  import streamlit as st
 
 
2
 
3
- # Установка конфигурации страницы
4
  st.set_page_config(
5
  page_title="GestureGuru",
6
- page_icon=":sparkles:",
7
  layout="wide",
8
- initial_sidebar_state="expanded",
9
  )
10
 
11
- # Добавление стилей
12
  st.markdown("""
13
- <style>
14
- /* Основной фон */
15
- .main {
16
- background: linear-gradient(135deg, #e0f7fa, #ffccbc);
17
- }
18
-
19
- /* Стиль боковой панели */
20
- .sidebar .sidebar-content {
21
- background: linear-gradient(135deg, #ffccbc, #ffc107);
22
- padding: 1rem;
23
- border-radius: 10px;
24
- color: #4CAF50;
25
- box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
26
- }
27
-
28
- /* Обертка для блока контента */
29
- .reportview-container .main .block-container {
30
- padding-top: 2rem;
31
- padding-bottom: 2rem;
32
- padding-left: 2rem;
33
- padding-right: 2rem;
34
- border-radius: 10px;
35
- background-color: white;
36
- box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
37
- }
38
-
39
- /* Стиль заголовка */
40
- .css-1h3lh1b {
41
- font-size: 2.5rem;
42
- color: #ff7043;
43
- }
44
-
45
- /* Стиль подзаголовка */
46
- .css-1siy2j7 {
47
- font-size: 1.5rem;
48
- color: #8d6e63;
49
- }
50
-
51
- /* Стиль кнопок */
52
- .stButton>button {
53
- background-color: #ff7043;
54
- color: white;
55
- border-radius: 5px;
56
- border: none;
57
- padding: 10px 20px;
58
- font-size: 16px;
59
- cursor: pointer;
60
- transition: background-color 0.3s ease;
61
- margin: 10px;
62
- }
63
-
64
- .stButton>button:hover {
65
- background-color: #f4511e;
66
- }
67
-
68
- /* Карточки */
69
- .card {
70
- background-color: #ffffff;
71
- padding: 20px;
72
- margin: 10px;
73
- border-radius: 10px;
74
- box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
75
- }
76
-
77
- /* Разделитель */
78
- .divider {
79
- height: 2px;
80
- background-color: #ff7043;
81
- margin: 20px 0;
82
- }
83
-
84
- /* Анимация */
85
- .fade-in {
86
- animation: fadeIn 2s;
87
- }
88
-
89
- @keyframes fadeIn {
90
- from { opacity: 0; }
91
- to { opacity: 1; }
92
- }
93
- </style>
94
  """, unsafe_allow_html=True)
95
 
96
- # Установка параметров URL
97
- # Установка параметров запроса
98
- #st.experimental_set_query_params(page="main")
99
- # Используйте переменную page после определения
100
-
101
- # Основной контент страницы
102
- st.title("GestureGuru")
103
- st.subheader("Russian Sign Language Recognition")
104
  st.markdown("""
105
- <div class="card fade-in">
106
- <p>This application is designed to recognize sign language using a webcam feed. The model has been trained to recognize various sign language gestures and display the corresponding text in real-time.</p>
107
- </div>
108
- <div class="divider"></div>
109
- <div class="card fade-in">
110
- <h3>Features:</h3>
111
- <ul>
112
- <li>Real-time sign language recognition</li>
113
- <li>Supports multiple gestures</li>
114
- <li>Easy to use interface</li>
115
- </ul>
116
- </div>
117
- <div class="divider"></div>
118
- <div class="card fade-in">
119
- <h3>How it works:</h3>
120
- <ol>
121
- <li>Upload a video or use the camera for live recognition.</li>
122
- <li>The model processes the video and identifies the gestures.</li>
123
- <li>The recognized gestures are displayed as text.</li>
124
- </ol>
125
- </div>
126
- <div class="divider"></div>
127
- <div class="card fade-in">
128
- <h3>Why use this app:</h3>
129
- <ul>
130
- <li>Helps bridge the communication gap between sign language users and others.</li>
131
- <li>Useful for educational purposes and learning sign language.</li>
132
- <li>Enhances accessibility for people with hearing impairments.</li>
133
- </ul>
134
- </div>
135
  """, unsafe_allow_html=True)
136
- st.image("image.webp", caption="Sign Language Recognition", use_column_width=True)
137
 
 
 
 
 
 
 
 
 
 
 
 
138
 
 
 
 
 
 
 
 
 
 
 
 
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
 
 
 
 
 
 
 
141
 
142
 
143
 
 
1
  import streamlit as st
2
+ from PIL import Image
3
+ import numpy as np
4
 
5
+ # Page config
6
  st.set_page_config(
7
  page_title="GestureGuru",
8
+ page_icon="🔍",
9
  layout="wide",
10
+ initial_sidebar_state="auto"
11
  )
12
 
13
+ # --- Custom Style ---
14
  st.markdown("""
15
+ <style>
16
+ body {
17
+ background-color: #f8f9fb;
18
+ }
19
+ header {
20
+ visibility: hidden;
21
+ }
22
+ section.main > div {
23
+ padding-top: 2rem;
24
+ padding-bottom: 2rem;
25
+ }
26
+ .hero {
27
+ text-align: center;
28
+ padding: 3rem 2rem;
29
+ background: linear-gradient(135deg, #f0f4ff, #e8fcf7);
30
+ border-radius: 12px;
31
+ box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.05);
32
+ }
33
+ .hero h1 {
34
+ font-size: 3em;
35
+ margin-bottom: 0.2em;
36
+ color: #31333F;
37
+ }
38
+ .hero p {
39
+ font-size: 1.25em;
40
+ color: #555;
41
+ margin-top: 0.5em;
42
+ }
43
+ .section {
44
+ background-color: white;
45
+ border-radius: 10px;
46
+ padding: 1.5rem;
47
+ margin-bottom: 1.5rem;
48
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
49
+ }
50
+ h3 {
51
+ color: #31333F;
52
+ }
53
+ ul, ol {
54
+ color: #555;
55
+ font-size: 1.1em;
56
+ }
57
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  """, unsafe_allow_html=True)
59
 
60
+ # --- Hero Section ---
 
 
 
 
 
 
 
61
  st.markdown("""
62
+ <div class="hero">
63
+ <h1>GestureGuru</h1>
64
+ <p>AI-powered Russian Sign Language Recognition</p>
65
+ <p>Enhancing communication through computer vision</p>
66
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  """, unsafe_allow_html=True)
 
68
 
69
+ # --- Features ---
70
+ st.markdown("""
71
+ <div class="section">
72
+ <h3>🌟 Features</h3>
73
+ <ul>
74
+ <li>🧠 Real-time sign language recognition</li>
75
+ <li>🖐️ Supports multiple gesture classes</li>
76
+ <li>💡 Simple, accessible UI</li>
77
+ </ul>
78
+ </div>
79
+ """, unsafe_allow_html=True)
80
 
81
+ # --- How it works ---
82
+ st.markdown("""
83
+ <div class="section">
84
+ <h3>🧰 How it works</h3>
85
+ <ol>
86
+ <li>Upload a video or use the live camera</li>
87
+ <li>The model processes the video stream</li>
88
+ <li>Recognized gestures appear as text output</li>
89
+ </ol>
90
+ </div>
91
+ """, unsafe_allow_html=True)
92
 
93
+ # --- Upload block (placeholder) ---
94
+ st.markdown("""
95
+ <div class="section">
96
+ <h3>📷 Try it now</h3>
97
+ <p>Upload a frame or short clip for recognition.</p>
98
+ """, unsafe_allow_html=True)
99
+ uploaded_file = st.file_uploader("Upload an image or video frame", type=["jpg", "jpeg", "png"])
100
+ if uploaded_file:
101
+ img = Image.open(uploaded_file)
102
+ st.image(img, caption="Uploaded frame", use_column_width=True)
103
+ st.info("Gesture recognition results will appear here.")
104
+ else:
105
+ st.warning("Please upload an image to test recognition.")
106
+ st.markdown("</div>", unsafe_allow_html=True)
107
 
108
+ # --- Contact block ---
109
+ st.markdown("""
110
+ <div class="section" style="text-align: center;">
111
+ <h3>📢 Want to collaborate?</h3>
112
+ <p>Email: <a href="mailto:your@email.com">your@email.com</a></p>
113
+ </div>
114
+ """, unsafe_allow_html=True)
115
 
116
 
117