Spaces:
Sleeping
Sleeping
Ana Pinto commited on
Commit ·
12d67ed
1
Parent(s): ed4d8e6
Fix broken layout and restore full Gradio interface
Browse files
app.py
CHANGED
|
@@ -118,86 +118,21 @@ def predict(image: np.ndarray, confidence: float) -> Tuple[np.ndarray, str]:
|
|
| 118 |
def build_interface() -> gr.Blocks:
|
| 119 |
"""Create the Gradio Blocks interface."""
|
| 120 |
custom_css = """
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
--text-main: #e9f0ff;
|
| 127 |
-
--text-sub: #a8bddf;
|
| 128 |
-
--accent: #22c1a1;
|
| 129 |
-
--accent-2: #f59e0b;
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
#app-shell {
|
| 133 |
-
background: radial-gradient(1200px 500px at 10% -10%, #1b2d52 0%, transparent 60%),
|
| 134 |
-
radial-gradient(1100px 500px at 100% 0%, #21385e 0%, transparent 55%),
|
| 135 |
-
linear-gradient(180deg, var(--bg-1), var(--bg-2));
|
| 136 |
-
min-height: 100vh;
|
| 137 |
-
color: var(--text-main);
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
#hero {
|
| 141 |
-
padding: 18px 20px;
|
| 142 |
-
border: 1px solid var(--panel-border);
|
| 143 |
-
border-radius: 16px;
|
| 144 |
-
background: linear-gradient(145deg, #13233f, #0f1b31);
|
| 145 |
-
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
|
| 146 |
-
margin-bottom: 10px;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
#hero h1 {
|
| 150 |
-
margin: 0;
|
| 151 |
-
font-size: 1.6rem;
|
| 152 |
-
letter-spacing: 0.3px;
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
#hero p {
|
| 156 |
-
margin: 8px 0 0;
|
| 157 |
-
color: var(--text-sub);
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
-
#input-panel, #output-panel {
|
| 161 |
-
border: 1px solid var(--panel-border);
|
| 162 |
-
border-radius: 14px;
|
| 163 |
-
background: color-mix(in oklab, var(--panel) 93%, black 7%);
|
| 164 |
-
padding: 10px;
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
#detect-btn button {
|
| 168 |
-
background: linear-gradient(90deg, var(--accent), #17a589) !important;
|
| 169 |
-
border: 0 !important;
|
| 170 |
-
color: #04201a !important;
|
| 171 |
-
font-weight: 700 !important;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
#input-image, #detection-image {
|
| 175 |
-
min-height: 460px;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
#input-image img, #detection-image img {
|
| 179 |
-
object-fit: contain !important;
|
| 180 |
-
background: #0b1428;
|
| 181 |
-
border-radius: 10px;
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
#time-box textarea {
|
| 185 |
-
font-weight: 600;
|
| 186 |
-
color: var(--text-main) !important;
|
| 187 |
-
}
|
| 188 |
"""
|
| 189 |
|
| 190 |
with gr.Blocks(title="Analog Clock Time Detector", css=custom_css) as demo:
|
| 191 |
-
gr.
|
| 192 |
"""
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
<h1>Analog Clock Time Detector</h1>
|
| 196 |
-
<p>Upload an analog clock photo and get a clean visual detection with predicted time in seconds precision when available.</p>
|
| 197 |
-
</div>
|
| 198 |
-
</div>
|
| 199 |
"""
|
| 200 |
)
|
|
|
|
| 201 |
|
| 202 |
with gr.Row(equal_height=True):
|
| 203 |
with gr.Column(elem_id="input-panel"):
|
|
|
|
| 118 |
def build_interface() -> gr.Blocks:
|
| 119 |
"""Create the Gradio Blocks interface."""
|
| 120 |
custom_css = """
|
| 121 |
+
.gradio-container {max-width: 1200px !important; margin: 0 auto !important;}
|
| 122 |
+
#input-panel, #output-panel {border-radius: 14px; border: 1px solid #d7deea; padding: 10px;}
|
| 123 |
+
#detect-btn button {font-weight: 700 !important;}
|
| 124 |
+
#input-image, #detection-image {height: 460px !important; min-height: 460px !important;}
|
| 125 |
+
#input-image img, #detection-image img {object-fit: contain !important;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
"""
|
| 127 |
|
| 128 |
with gr.Blocks(title="Analog Clock Time Detector", css=custom_css) as demo:
|
| 129 |
+
gr.Markdown(
|
| 130 |
"""
|
| 131 |
+
# Analog Clock Time Detector
|
| 132 |
+
Detect the time from analog watch or clock images with YOLOv8.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
"""
|
| 134 |
)
|
| 135 |
+
gr.Markdown("Upload an image, set confidence and click **Detect time**.")
|
| 136 |
|
| 137 |
with gr.Row(equal_height=True):
|
| 138 |
with gr.Column(elem_id="input-panel"):
|