JeffreyXiang commited on
Commit
f69400c
·
1 Parent(s): 485fdde
Files changed (1) hide show
  1. app.py +12 -17
app.py CHANGED
@@ -87,7 +87,6 @@ css = """
87
  transform: unset !important;
88
  }
89
 
90
-
91
  /* Previewer */
92
  .previewer-container {
93
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -185,6 +184,17 @@ css = """
185
  .previewer-container input[type=range]::-webkit-slider-thumb:hover {
186
  transform: scale(1.2);
187
  }
 
 
 
 
 
 
 
 
 
 
 
188
  """
189
 
190
 
@@ -235,21 +245,6 @@ head = """
235
  function onSliderChange(val) {
236
  refreshView(-1, parseInt(val));
237
  }
238
-
239
- function modify_html_container() {
240
- const container = document.querySelector('.previewer-container');
241
- const html_container = container.parentNode.parentNode.parentNode;
242
-
243
- // Remove class padded
244
- html_container.classList.remove('padded');
245
-
246
- // Search for data-testid="block-label" in html_container's children
247
- const status_tracker = html_container.querySelector('[data-testid="block-label"]');
248
- if (status_tracker) {
249
- // Add class float
250
- status_tracker.classList.add('float');
251
- }
252
- }
253
  </script>
254
  """
255
 
@@ -550,7 +545,7 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
550
  with gr.Column(scale=10):
551
  with gr.Walkthrough(selected=0) as walkthrough:
552
  with gr.Step("Preview", id=0):
553
- preview_output = gr.HTML(empty_html, label="3D Asset Preview", show_label=True, container=True, js_on_load="modify_html_container()")
554
  extract_btn = gr.Button("Extract GLB")
555
  with gr.Step("Extract", id=1):
556
  glb_output = gr.Model3D(label="Extracted GLB", height=724, show_label=True, display_mode="solid", clear_color=(0.25, 0.25, 0.25, 1.0))
 
87
  transform: unset !important;
88
  }
89
 
 
90
  /* Previewer */
91
  .previewer-container {
92
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
 
184
  .previewer-container input[type=range]::-webkit-slider-thumb:hover {
185
  transform: scale(1.2);
186
  }
187
+
188
+ /* Overwrite Previewer Block Style */
189
+ .gradio-container .padded:has(.previewer-container) {
190
+ padding: 0 !important;
191
+ }
192
+
193
+ .gradio-container:has(.previewer-container) [data-testid="block-label"] {
194
+ position: absolute;
195
+ top: 0;
196
+ left: 0;
197
+ }
198
  """
199
 
200
 
 
245
  function onSliderChange(val) {
246
  refreshView(-1, parseInt(val));
247
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  </script>
249
  """
250
 
 
545
  with gr.Column(scale=10):
546
  with gr.Walkthrough(selected=0) as walkthrough:
547
  with gr.Step("Preview", id=0):
548
+ preview_output = gr.HTML(empty_html, label="3D Asset Preview", show_label=True, container=True)
549
  extract_btn = gr.Button("Extract GLB")
550
  with gr.Step("Extract", id=1):
551
  glb_output = gr.Model3D(label="Extracted GLB", height=724, show_label=True, display_mode="solid", clear_color=(0.25, 0.25, 0.25, 1.0))