Spaces:
Running
on
Zero
Running
on
Zero
File size: 4,822 Bytes
fcf2ce0 |
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 |
class Style:
@staticmethod
def get_css():
"""返回應用程式的 CSS 樣式"""
css = """
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
min-height: 100vh;
}
.gradio-container {
max-width: 1200px !important;
margin: 0 auto; /* 確保容器居中 */
padding: 1rem;
width: 100%;
}
.app-header {
text-align: center;
margin-bottom: 2rem;
background: rgba(255, 255, 255, 0.8);
padding: 1.5rem;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
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;
}
.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;
}
.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; /* 確保面板居中 */
}
/* 改變灰色背景為更好看的漸變色 */
.how-to-use {
background: linear-gradient(135deg, #f6f9fc, #edf2f7);
border-radius: 10px;
padding: 1.5rem;
margin-top: 1rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
color: #2d3748;
}
.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;
}
.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;
}
/* 確保標籤和內容都置中 */
.gr-form, .gr-box, .gr-panel {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin: 0 auto;
}
/* 確保圖像上傳界面居中 */
.upload-box {
margin: 0 auto;
text-align: center;
max-width: 500px;
}
.footer {
text-align: center;
margin-top: 2rem;
font-size: 0.9rem;
color: #4A5568;
padding: 1rem;
background: rgba(255, 255, 255, 0.5);
border-radius: 10px;
width: 100%;
}
/* 中央對齊所有容器 */
.container, .gr-container, .gr-row, .gr-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
/* 改善標籤頁樣式 */
.tabs {
width: 100%;
display: flex;
justify-content: center;
}
/* 改善表單和控制項置中 */
label, button, select, .gr-input, .gr-button, .gr-checkbox, .gr-radio, .gr-slider {
margin-left: auto;
margin-right: auto;
}
/* 響應式調整 */
@media (max-width: 768px) {
.app-title {
font-size: 2rem;
}
.app-subtitle {
font-size: 1rem;
}
.gradio-container {
padding: 0.5rem;
}
}
"""
return css
|