lichih commited on
Commit
52b4297
·
verified ·
1 Parent(s): bbc222e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -49
app.py CHANGED
@@ -77,51 +77,51 @@ def draw_bar_chart(data: dict[str, list[str | float]]):
77
  return plt
78
 
79
 
80
- css = """
81
- .main-title {
82
- font-size: 24px;
83
- font-weight: bold;
84
- text-align: center;
85
- margin-bottom: 20px;
86
- }
87
- .reference {
88
- text-align: center;
89
- font-size: 1.2em;
90
- color: #d1d5db;
91
- margin-bottom: 20px;
92
- }
93
- .reference a {
94
- color: #FB923C;
95
- text-decoration: none;
96
- }
97
- .reference a:hover {
98
- text-decoration: underline;
99
- color: #FB923C;
100
- }
101
- .title {
102
- border-bottom: 1px solid;
103
- }
104
- .footer {
105
- text-align: center;
106
- margin-top: 30px;
107
- padding-top: 20px;
108
- border-top: 1px solid #ddd;
109
- color: #d1d5db;
110
- font-size: 14px;
111
- }
112
- """
113
- # theme = gr.themes.Base(
114
- # primary_hue="orange",
115
- # secondary_hue="orange",
116
- # neutral_hue="gray",
117
- # font=gr.themes.GoogleFont("Source Sans Pro"),
118
- # ).set(
119
- # background_fill_primary="*neutral_950", # 主背景色(深黑)
120
- # button_primary_background_fill="*primary_500", # 按鈕顏色(橘色)
121
- # body_text_color="*neutral_200", # 文字顏色(淺色)
122
- # )
123
  def get_layout():
124
- with gr.Blocks(css=None, theme='gstaff/xkcd') as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  with gr.Column():
126
  gr.HTML(
127
  value=(
@@ -137,17 +137,16 @@ def get_layout():
137
  with gr.Row(equal_height=True):
138
  image_input = gr.Image(label="上傳影像", type="pil")
139
  bar_chart = gr.Plot(label="分類結果")
 
140
  start_button = gr.Button("開始分類", variant="primary")
141
-
 
 
142
  start_button.click(
143
  fn=Classifier().predict,
144
  inputs=image_input,
145
  outputs=bar_chart,
146
  )
147
-
148
- gr.HTML(
149
- '<div class="footer">© 2024 LCL 版權所有<br>開發者:何立智、楊哲睿</div>',
150
- )
151
 
152
  return demo
153
 
 
77
  return plt
78
 
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  def get_layout():
81
+ css = """
82
+ .main-title {
83
+ font-size: 24px;
84
+ font-weight: bold;
85
+ text-align: center;
86
+ margin-bottom: 20px;
87
+ }
88
+ .reference {
89
+ text-align: center;
90
+ font-size: 1.2em;
91
+ color: #d1d5db;
92
+ margin-bottom: 20px;
93
+ }
94
+ .reference a {
95
+ color: #FB923C;
96
+ text-decoration: none;
97
+ }
98
+ .reference a:hover {
99
+ text-decoration: underline;
100
+ color: #FB923C;
101
+ }
102
+ .title {
103
+ border-bottom: 1px solid;
104
+ }
105
+ .footer {
106
+ text-align: center;
107
+ margin-top: 30px;
108
+ padding-top: 20px;
109
+ border-top: 1px solid #ddd;
110
+ color: #d1d5db;
111
+ font-size: 14px;
112
+ }
113
+ """
114
+ theme = gr.themes.Base(
115
+ primary_hue="orange",
116
+ secondary_hue="orange",
117
+ neutral_hue="gray",
118
+ font=gr.themes.GoogleFont("Source Sans Pro"),
119
+ ).set(
120
+ background_fill_primary="*neutral_950", # 主背景色(深黑)
121
+ button_primary_background_fill="*primary_500", # 按鈕顏色(橘色)
122
+ body_text_color="*neutral_200", # 文字顏色(淺色)
123
+ )
124
+ with gr.Blocks(css=css, theme=theme) as demo:
125
  with gr.Column():
126
  gr.HTML(
127
  value=(
 
137
  with gr.Row(equal_height=True):
138
  image_input = gr.Image(label="上傳影像", type="pil")
139
  bar_chart = gr.Plot(label="分類結果")
140
+
141
  start_button = gr.Button("開始分類", variant="primary")
142
+ gr.HTML(
143
+ '<div class="footer">© 2024 LCL 版權所有<br>開發者:何立智、楊哲睿</div>',
144
+ )
145
  start_button.click(
146
  fn=Classifier().predict,
147
  inputs=image_input,
148
  outputs=bar_chart,
149
  )
 
 
 
 
150
 
151
  return demo
152