Spaces:
Running
on
Zero
Running
on
Zero
File size: 8,742 Bytes
611206a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
class Style:
@staticmethod
def get_css():
"""Return the application's CSS styles with improved aesthetics"""
css = """
/* Base styles and typography */
body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #f0f9ff, #e1f5fe);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
min-height: 100vh;
}
/* Typography improvements */
h1, h2, h3, h4, h5, h6, p, span, div, label, button {
font-family: Arial, sans-serif;
}
/* Container styling */
.gradio-container {
max-width: 1200px !important;
margin: 0 auto;
padding: 1rem;
width: 100%;
}
/* Header area styling with gradient background */
.app-header {
text-align: center;
margin-bottom: 2rem;
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
padding: 1.5rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
width: 100%;
}
.app-title {
color: #2D3748;
font-size: 2.5rem;
margin-bottom: 0.5rem;
background: linear-gradient(90deg, #38b2ac, #4299e1);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: bold;
}
.app-subtitle {
color: #4A5568;
font-size: 1.2rem;
font-weight: normal;
margin-top: 0.25rem;
}
.app-divider {
width: 80px;
height: 3px;
background: linear-gradient(90deg, #38b2ac, #4299e1);
margin: 1rem auto;
}
/* Panel styling - gradient background */
.input-panel, .output-panel {
background: white;
border-radius: 10px;
padding: 1.5rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
margin: 0 auto 1rem auto;
}
/* Section heading styling with gradient background */
.section-heading {
font-size: 1.25rem;
font-weight: 600;
color: #2D3748;
margin-bottom: 1rem;
margin-top: 0.5rem;
text-align: center;
padding: 0.8rem;
background: linear-gradient(to right, #e6f3fc, #f0f9ff);
border-radius: 8px;
}
/* How-to-use section with gradient background */
.how-to-use {
background: linear-gradient(135deg, #f8fafc, #e8f4fd);
border-radius: 10px;
padding: 1.5rem;
margin-top: 1rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
color: #2d3748;
}
/* Detection button styling */
.detect-btn {
background: linear-gradient(90deg, #38b2ac, #4299e1) !important;
color: white !important;
border: none !important;
border-radius: 8px !important;
transition: transform 0.3s, box-shadow 0.3s !important;
font-weight: bold !important;
letter-spacing: 0.5px !important;
padding: 0.75rem 1.5rem !important;
width: 100%;
margin: 1rem auto !important;
font-family: Arial, sans-serif !important;
}
.detect-btn:hover {
transform: translateY(-2px) !important;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}
.detect-btn:active {
transform: translateY(1px) !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}
/* JSON display improvements */
.json-display pre {
background: #f8fafc;
border-radius: 6px;
padding: 1rem;
font-family: 'Consolas', 'Monaco', monospace;
white-space: pre-wrap;
max-height: 500px;
overflow-y: auto;
box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
}
.json-key {
color: #e53e3e;
}
.json-value {
color: #2b6cb0;
}
.json-string {
color: #38a169;
}
/* Chart/plot styling improvements */
.plot-container {
background: white;
border-radius: 8px;
padding: 0.5rem;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
/* Larger font for plots */
.plot-container text {
font-family: Arial, sans-serif !important;
font-size: 14px !important;
}
/* Title styling for charts */
.plot-title {
font-family: Arial, sans-serif !important;
font-size: 16px !important;
font-weight: bold !important;
}
/* Tab styling with subtle gradient */
.tabs {
width: 100%;
display: flex;
justify-content: center;
}
.tabs > div:first-child {
background: linear-gradient(to right, #f8fafc, #e8f4fd) !important;
border-radius: 8px 8px 0 0;
}
/* Footer styling with gradient background */
.footer {
text-align: center;
margin-top: 2rem;
font-size: 0.9rem;
color: #4A5568;
padding: 1rem;
background: linear-gradient(135deg, #f8f9fa, #e1effe);
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
width: 100%;
}
/* Ensure centering works for all elements */
.container, .gr-container, .gr-row, .gr-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
/* 結果文本框的改進樣式 */
#detection-details, .wide-result-text {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
.wide-result-text textarea {
width: 100% !important;
min-width: 600px !important;
font-family: 'Arial', sans-serif !important;
font-size: 14px !important;
line-height: 1.5 !important; /* 減少行間距 */
padding: 16px !important;
white-space: pre-wrap !important;
background-color: #f8f9fa !important;
border-radius: 8px !important;
min-height: 300px !important;
resize: none !important;
overflow-y: auto !important;
border: 1px solid #e2e8f0 !important;
display: block !important;
}
/* 結果詳情面板樣式 - 加入漸層背景 */
.result-details-box {
width: 100% !important;
margin-top: 1.5rem;
background: linear-gradient(135deg, #f8fafc, #e8f4fd);
border-radius: 10px;
padding: 1rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
/* 確保結果詳情面板內的元素寬度可以適應面板 */
.result-details-box > * {
width: 100% !important;
max-width: 100% !important;
}
/* 確保文本區域不會被限制寬度 */
.result-details-box .gr-text-input {
width: 100% !important;
max-width: none !important;
}
/* 輸出面板內容的布局調整 */
.output-panel {
display: flex;
flex-direction: column;
width: 100%;
padding: 0 !important;
}
/* 確保結果面板內的元素寬度可以適應面板 */
.output-panel > * {
width: 100%;
}
/* 改善統計面板列佈局 */
.plot-column, .stats-column {
display: flex;
flex-direction: column;
padding: 1rem;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.app-title {
font-size: 2rem;
}
.app-subtitle {
font-size: 1rem;
}
.gradio-container {
padding: 0.5rem;
}
}
"""
return css
|