Spaces:
Sleeping
Sleeping
zxcvb6958 commited on
Commit ·
cec8559
1
Parent(s): fd22acc
update UI
Browse files
app.py
CHANGED
|
@@ -46,14 +46,8 @@ def open_img(img_path):
|
|
| 46 |
else:
|
| 47 |
img = Image.open(img_path)
|
| 48 |
w, h = img.size
|
| 49 |
-
if
|
| 50 |
-
|
| 51 |
-
new_w = 300
|
| 52 |
-
new_h = int(h * 300 / w)
|
| 53 |
-
else:
|
| 54 |
-
new_h = 300
|
| 55 |
-
new_w = int(w * 300 / h)
|
| 56 |
-
img = img.resize((new_w, new_h), Image.LANCZOS)
|
| 57 |
return img
|
| 58 |
|
| 59 |
def show_enhance_input(img_name):
|
|
@@ -126,48 +120,59 @@ def diagnose_demo(img_name):
|
|
| 126 |
suggestion = SUGGESTION_DICT.get(main_cat, "建议:请咨询医生。")
|
| 127 |
return result_table, result_text, suggestion
|
| 128 |
|
| 129 |
-
# --- CSS ---
|
| 130 |
css = """
|
| 131 |
.orange-btn {
|
| 132 |
background: #FF7F1F !important;
|
| 133 |
color: white !important;
|
| 134 |
font-weight: bold;
|
| 135 |
-
border: 2px solid #
|
| 136 |
border-radius: 12px !important;
|
| 137 |
-
font-size:
|
| 138 |
-
padding:
|
| 139 |
margin-left: 10px !important;
|
|
|
|
| 140 |
box-shadow: none !important;
|
| 141 |
}
|
| 142 |
.gray-btn {
|
| 143 |
background: #EBEBEE !important;
|
| 144 |
color: black !important;
|
| 145 |
font-weight: bold;
|
| 146 |
-
border: 2px solid #
|
| 147 |
border-radius: 12px !important;
|
| 148 |
-
font-size:
|
| 149 |
-
padding:
|
| 150 |
margin-right: 10px !important;
|
|
|
|
| 151 |
box-shadow: none !important;
|
| 152 |
}
|
| 153 |
.button-row {
|
| 154 |
-
margin-top:
|
| 155 |
}
|
| 156 |
.big-group {
|
| 157 |
-
|
| 158 |
-
border
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
margin-
|
| 162 |
-
|
| 163 |
-
box-shadow: 0
|
| 164 |
}
|
| 165 |
.big-title {
|
| 166 |
-
font-size:
|
| 167 |
font-weight: bold;
|
| 168 |
-
margin-bottom:
|
| 169 |
-
margin-left:
|
| 170 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
"""
|
| 173 |
|
|
|
|
| 46 |
else:
|
| 47 |
img = Image.open(img_path)
|
| 48 |
w, h = img.size
|
| 49 |
+
if w != 300 or h != 300:
|
| 50 |
+
img = img.resize((300, 300), Image.LANCZOS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
return img
|
| 52 |
|
| 53 |
def show_enhance_input(img_name):
|
|
|
|
| 120 |
suggestion = SUGGESTION_DICT.get(main_cat, "建议:请咨询医生。")
|
| 121 |
return result_table, result_text, suggestion
|
| 122 |
|
|
|
|
| 123 |
css = """
|
| 124 |
.orange-btn {
|
| 125 |
background: #FF7F1F !important;
|
| 126 |
color: white !important;
|
| 127 |
font-weight: bold;
|
| 128 |
+
border: 2px solid #111 !important;
|
| 129 |
border-radius: 12px !important;
|
| 130 |
+
font-size: 15px !important;
|
| 131 |
+
padding: 7px 16px !important;
|
| 132 |
margin-left: 10px !important;
|
| 133 |
+
min-width: 90px;
|
| 134 |
box-shadow: none !important;
|
| 135 |
}
|
| 136 |
.gray-btn {
|
| 137 |
background: #EBEBEE !important;
|
| 138 |
color: black !important;
|
| 139 |
font-weight: bold;
|
| 140 |
+
border: 2px solid #111 !important;
|
| 141 |
border-radius: 12px !important;
|
| 142 |
+
font-size: 15px !important;
|
| 143 |
+
padding: 7px 16px !important;
|
| 144 |
margin-right: 10px !important;
|
| 145 |
+
min-width: 90px;
|
| 146 |
box-shadow: none !important;
|
| 147 |
}
|
| 148 |
.button-row {
|
| 149 |
+
margin-top: 8px;
|
| 150 |
}
|
| 151 |
.big-group {
|
| 152 |
+
background: #F5F6F7 !important;
|
| 153 |
+
border: 2px solid #e0e2e5 !important;
|
| 154 |
+
border-radius: 18px !important;
|
| 155 |
+
padding: 28px 18px 24px 18px !important;
|
| 156 |
+
margin-top: 28px !important;
|
| 157 |
+
margin-bottom: 18px !important;
|
| 158 |
+
box-shadow: 0 3px 12px 2px rgba(60,64,67,.14);
|
| 159 |
}
|
| 160 |
.big-title {
|
| 161 |
+
font-size: 25px;
|
| 162 |
font-weight: bold;
|
| 163 |
+
margin-bottom: 18px;
|
| 164 |
+
margin-left: 4px;
|
| 165 |
+
color: #343434;
|
| 166 |
+
letter-spacing: 1px;
|
| 167 |
+
}
|
| 168 |
+
.gr-image, .gr-image-preview {
|
| 169 |
+
border-radius: 10px !important;
|
| 170 |
+
background: #fff !important;
|
| 171 |
+
box-shadow: 0 2px 12px 0 rgba(60,64,67,.08);
|
| 172 |
+
}
|
| 173 |
+
.gr-box .gr-block.gr-group {
|
| 174 |
+
box-shadow: none;
|
| 175 |
+
border: none;
|
| 176 |
}
|
| 177 |
"""
|
| 178 |
|