haxerwddle commited on
Commit
e3b48b4
·
1 Parent(s): a16e439

UI change

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -63,7 +63,7 @@ def full_pipeline(image):
63
 
64
  # ------------------ GRADIO UI ------------------
65
  # =========================
66
- # CSS TÙY CHỈNH GIAO DIỆN
67
  # =========================
68
  custom_css = """
69
  #main-title {
@@ -122,7 +122,7 @@ custom_css = """
122
  """
123
 
124
  # =========================
125
- # ỨNG DỤNG GRADIO UI
126
  # =========================
127
  with gr.Blocks() as demo:
128
 
@@ -178,10 +178,14 @@ with gr.Blocks() as demo:
178
 
179
  # ---- JS ANIMATION FOR PROGRESS BAR
180
  animate_js = """
181
- function(p){
182
  let bar = document.getElementById('loading-bar');
183
- if (bar){
184
- bar.style.width = (p * 100) + "%";
 
 
 
 
185
  }
186
  }
187
  """
@@ -190,7 +194,8 @@ with gr.Blocks() as demo:
190
  full_pipeline,
191
  inputs=img_input,
192
  outputs=[cls_output, explain_output],
193
- progress=animate_js
194
  )
195
 
 
196
  demo.launch(css=custom_css)
 
63
 
64
  # ------------------ GRADIO UI ------------------
65
  # =========================
66
+ # CSS
67
  # =========================
68
  custom_css = """
69
  #main-title {
 
122
  """
123
 
124
  # =========================
125
+ # GRADIO UI
126
  # =========================
127
  with gr.Blocks() as demo:
128
 
 
178
 
179
  # ---- JS ANIMATION FOR PROGRESS BAR
180
  animate_js = """
181
+ () => {
182
  let bar = document.getElementById('loading-bar');
183
+ if (bar) {
184
+ bar.style.transition = "width 0.35s ease-out";
185
+ bar.style.width = "100%";
186
+
187
+ // Reset after finished
188
+ setTimeout(() => { bar.style.width = "0%"; }, 1200);
189
  }
190
  }
191
  """
 
194
  full_pipeline,
195
  inputs=img_input,
196
  outputs=[cls_output, explain_output],
197
+ js=animate_js
198
  )
199
 
200
+
201
  demo.launch(css=custom_css)