sagar007 commited on
Commit
10c3cd8
β€’
1 Parent(s): cfb69be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -51
app.py CHANGED
@@ -7,19 +7,21 @@ import yolov9
7
  HTML_TEMPLATE = """
8
  <style>
9
  body {
10
- background: linear-gradient(135deg, #2c3e50, #34495e, #95a5a6);
11
- font-family: 'Arial', sans-serif;
12
  color: #ecf0f1;
 
13
  }
14
  #app-header {
15
  text-align: center;
16
- background: rgba(52, 73, 94, 0.9);
17
- padding: 30px;
18
  border-radius: 20px;
19
- box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
20
  position: relative;
21
  overflow: hidden;
22
- margin-bottom: 30px;
 
23
  }
24
  #app-header::before {
25
  content: "";
@@ -28,89 +30,104 @@ HTML_TEMPLATE = """
28
  left: -50%;
29
  width: 200%;
30
  height: 200%;
31
- background: radial-gradient(circle, rgba(236,240,241,0.3) 0%, rgba(236,240,241,0) 70%);
32
- animation: shimmer 15s infinite linear;
33
  }
34
  @keyframes shimmer {
35
  0% { transform: rotate(0deg); }
36
  100% { transform: rotate(360deg); }
37
  }
38
  #app-header h1 {
39
- color: #e74c3c;
40
- font-size: 2.5em;
41
- margin-bottom: 15px;
42
- text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
43
  }
44
  #app-header p {
45
- font-size: 1.2em;
46
- color: #bdc3c7;
47
  }
48
  .feature-container {
49
  display: flex;
50
  justify-content: center;
51
- gap: 30px;
52
- margin-top: 30px;
53
  flex-wrap: wrap;
54
  }
55
  .feature {
56
  position: relative;
57
- transition: transform 0.3s, box-shadow 0.3s;
58
  border-radius: 15px;
59
  overflow: hidden;
60
- background: #2c3e50;
61
- box-shadow: 0 5px 15px rgba(0,0,0,0.2);
 
 
 
 
 
 
62
  }
63
  .feature:hover {
64
- transform: translateY(-10px) rotate(2deg);
65
- box-shadow: 0 15px 30px rgba(0,0,0,0.3);
 
66
  }
67
  .feature-icon {
68
- font-size: 3em;
69
- padding: 20px;
70
- color: #e74c3c;
 
 
 
 
71
  }
72
  .feature-description {
73
- background-color: #34495e;
74
  color: #ecf0f1;
75
- padding: 10px;
76
- font-size: 0.9em;
77
  text-align: center;
 
 
 
 
 
78
  }
79
  .artifact {
80
  position: absolute;
81
- background: radial-gradient(circle, rgba(231,76,60,0.3) 0%, rgba(231,76,60,0) 70%);
82
  border-radius: 50%;
83
  opacity: 0.5;
 
84
  }
85
  .artifact.large {
86
- width: 400px;
87
- height: 400px;
88
- top: -100px;
89
- left: -200px;
90
- animation: float 20s infinite ease-in-out;
91
  }
92
  .artifact.medium {
93
- width: 300px;
94
- height: 300px;
95
- bottom: -150px;
96
- right: -150px;
97
- animation: float 15s infinite ease-in-out reverse;
98
  }
99
  .artifact.small {
100
- width: 150px;
101
- height: 150px;
102
  top: 50%;
103
  left: 50%;
104
  transform: translate(-50%, -50%);
105
- animation: pulse 5s infinite alternate;
106
  }
107
  @keyframes float {
108
  0%, 100% { transform: translateY(0) rotate(0deg); }
109
- 50% { transform: translateY(-20px) rotate(10deg); }
110
  }
111
  @keyframes pulse {
112
- 0% { transform: scale(1); opacity: 0.5; }
113
- 100% { transform: scale(1.1); opacity: 0.8; }
114
  }
115
  </style>
116
  <div id="app-header">
@@ -118,28 +135,29 @@ HTML_TEMPLATE = """
118
  <div class="artifact medium"></div>
119
  <div class="artifact small"></div>
120
  <h1>YOLOv9: Manhole Detector</h1>
121
- <p>Detect manholes in images with advanced AI technology</p>
122
  <div class="feature-container">
123
  <div class="feature">
124
- <div class="feature-icon">πŸ”</div>
125
- <div class="feature-description">High Accuracy Detection</div>
126
  </div>
127
  <div class="feature">
128
  <div class="feature-icon">⚑</div>
129
- <div class="feature-description">Fast Processing</div>
130
  </div>
131
  <div class="feature">
132
  <div class="feature-icon">πŸ–ΌοΈ</div>
133
- <div class="feature-description">Image Size Adjustment</div>
134
  </div>
135
  <div class="feature">
136
- <div class="feature-icon">🎚️</div>
137
- <div class="feature-description">Customizable Thresholds</div>
138
  </div>
139
  </div>
140
  </div>
141
  """
142
 
 
143
  def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
144
  model = yolov9.load('./best.pt')
145
  model.conf = conf_threshold
 
7
  HTML_TEMPLATE = """
8
  <style>
9
  body {
10
+ background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
11
+ font-family: 'Roboto', sans-serif;
12
  color: #ecf0f1;
13
+ min-height: 100vh;
14
  }
15
  #app-header {
16
  text-align: center;
17
+ background: rgba(26, 42, 108, 0.8);
18
+ padding: 40px;
19
  border-radius: 20px;
20
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
21
  position: relative;
22
  overflow: hidden;
23
+ margin-bottom: 40px;
24
+ backdrop-filter: blur(10px);
25
  }
26
  #app-header::before {
27
  content: "";
 
30
  left: -50%;
31
  width: 200%;
32
  height: 200%;
33
+ background: radial-gradient(circle, rgba(253,187,45,0.2) 0%, rgba(253,187,45,0) 70%);
34
+ animation: shimmer 20s infinite linear;
35
  }
36
  @keyframes shimmer {
37
  0% { transform: rotate(0deg); }
38
  100% { transform: rotate(360deg); }
39
  }
40
  #app-header h1 {
41
+ color: #fdbb2d;
42
+ font-size: 3em;
43
+ margin-bottom: 20px;
44
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
45
  }
46
  #app-header p {
47
+ font-size: 1.3em;
48
+ color: #ecf0f1;
49
  }
50
  .feature-container {
51
  display: flex;
52
  justify-content: center;
53
+ gap: 40px;
54
+ margin-top: 40px;
55
  flex-wrap: wrap;
56
  }
57
  .feature {
58
  position: relative;
59
+ transition: all 0.4s ease;
60
  border-radius: 15px;
61
  overflow: hidden;
62
+ background: rgba(178, 31, 31, 0.7);
63
+ box-shadow: 0 8px 20px rgba(0,0,0,0.3);
64
+ width: 180px;
65
+ height: 180px;
66
+ display: flex;
67
+ flex-direction: column;
68
+ justify-content: center;
69
+ align-items: center;
70
  }
71
  .feature:hover {
72
+ transform: translateY(-15px) rotate(5deg) scale(1.05);
73
+ box-shadow: 0 20px 40px rgba(0,0,0,0.4);
74
+ background: rgba(253, 187, 45, 0.8);
75
  }
76
  .feature-icon {
77
+ font-size: 4em;
78
+ color: #ecf0f1;
79
+ margin-bottom: 15px;
80
+ transition: all 0.4s ease;
81
+ }
82
+ .feature:hover .feature-icon {
83
+ transform: scale(1.2);
84
  }
85
  .feature-description {
 
86
  color: #ecf0f1;
87
+ font-size: 1em;
 
88
  text-align: center;
89
+ padding: 0 10px;
90
+ transition: all 0.4s ease;
91
+ }
92
+ .feature:hover .feature-description {
93
+ font-weight: bold;
94
  }
95
  .artifact {
96
  position: absolute;
97
+ background: radial-gradient(circle, rgba(253,187,45,0.3) 0%, rgba(253,187,45,0) 70%);
98
  border-radius: 50%;
99
  opacity: 0.5;
100
+ filter: blur(40px);
101
  }
102
  .artifact.large {
103
+ width: 600px;
104
+ height: 600px;
105
+ top: -200px;
106
+ left: -300px;
107
+ animation: float 30s infinite ease-in-out;
108
  }
109
  .artifact.medium {
110
+ width: 400px;
111
+ height: 400px;
112
+ bottom: -200px;
113
+ right: -200px;
114
+ animation: float 25s infinite ease-in-out reverse;
115
  }
116
  .artifact.small {
117
+ width: 200px;
118
+ height: 200px;
119
  top: 50%;
120
  left: 50%;
121
  transform: translate(-50%, -50%);
122
+ animation: pulse 8s infinite alternate;
123
  }
124
  @keyframes float {
125
  0%, 100% { transform: translateY(0) rotate(0deg); }
126
+ 50% { transform: translateY(-30px) rotate(15deg); }
127
  }
128
  @keyframes pulse {
129
+ 0% { transform: scale(1) translate(-50%, -50%); opacity: 0.5; }
130
+ 100% { transform: scale(1.2) translate(-50%, -50%); opacity: 0.8; }
131
  }
132
  </style>
133
  <div id="app-header">
 
135
  <div class="artifact medium"></div>
136
  <div class="artifact small"></div>
137
  <h1>YOLOv9: Manhole Detector</h1>
138
+ <p>Unleash the power of AI to detect manholes with precision</p>
139
  <div class="feature-container">
140
  <div class="feature">
141
+ <div class="feature-icon">🎯</div>
142
+ <div class="feature-description">High Precision Detection</div>
143
  </div>
144
  <div class="feature">
145
  <div class="feature-icon">⚑</div>
146
+ <div class="feature-description">Lightning-Fast Processing</div>
147
  </div>
148
  <div class="feature">
149
  <div class="feature-icon">πŸ–ΌοΈ</div>
150
+ <div class="feature-description">Dynamic Image Resizing</div>
151
  </div>
152
  <div class="feature">
153
+ <div class="feature-icon">πŸ”§</div>
154
+ <div class="feature-description">Fine-Tuned Thresholds</div>
155
  </div>
156
  </div>
157
  </div>
158
  """
159
 
160
+ # The rest of the Python code remains the same
161
  def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
162
  model = yolov9.load('./best.pt')
163
  model.conf = conf_threshold