Zaiiida commited on
Commit
77706c8
·
verified ·
1 Parent(s): 708d74e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -23
app.py CHANGED
@@ -53,40 +53,55 @@ def generate(image):
53
  mesh.export(mesh_path2.name)
54
  return mesh_path2.name
55
 
56
- # Loading bar controls
57
- def start_loading(loader_id):
58
- return f"<script>document.getElementById('{loader_id}').style.display = 'block';</script>"
59
 
60
- def stop_loading(loader_id):
61
- return f"<script>document.getElementById('{loader_id}').style.display = 'none';</script>"
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  # Custom CSS and theme
64
  css = """
65
- /* Loaders inside their respective rows */
66
- .loader {
67
- display: none;
68
  position: absolute;
69
- top: 50%;
70
- left: 50%;
71
  transform: translate(-50%, -50%);
72
- width: 40px;
73
- height: 40px;
74
- border: 5px solid #f3f3f3;
75
- border-top: 5px solid #5271FF;
76
- border-radius: 50%;
77
  animation: spin 1s linear infinite;
78
  }
79
 
80
  @keyframes spin {
81
- 0% { transform: translate(-50%, -50%) rotate(0deg); }
82
- 100% { transform: translate(-50%, -50%) rotate(360deg); }
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
- /* Loader container positions */
86
- #image-container,
87
- #process-container,
88
- #generate-container {
89
- position: relative;
90
  }
91
 
92
  /* Button styling remains as original */
@@ -117,7 +132,10 @@ with gr.Blocks(css=css) as demo:
117
  width=400,
118
  height=300,
119
  )
120
- loading_bar_image = gr.HTML("<div class='loader' id='image-loader'></div>")
 
 
 
121
 
122
  # Row 2: Processing options
123
  with gr.Row(elem_id="process-container"):
 
53
  mesh.export(mesh_path2.name)
54
  return mesh_path2.name
55
 
56
+ def start_loading_image():
57
+ return "<div id='loading-image' style='display: block;'></div>"
 
58
 
59
+ def start_loading_processed():
60
+ return "<div id='loading-processed' style='display: block;'></div>"
61
+
62
+ def start_loading_model():
63
+ return "<div id='loading-model' style='display: block;'></div>"
64
+ def stop_loading_image():
65
+ return "<div id='loading-image' style='display: none;'></div>"
66
+
67
+ def stop_loading_processed():
68
+ return "<div id='loading-processed' style='display: none;'></div>"
69
+
70
+ def stop_loading_model():
71
+ return "<div id='loading-model' style='display: none;'></div>"
72
 
73
  # Custom CSS and theme
74
  css = """
75
+ .custom-loader {
76
+ display: none; /* По умолчанию скрыто */
 
77
  position: absolute;
78
+ top: 50%;
79
+ left: 50%;
80
  transform: translate(-50%, -50%);
81
+ width: 40px;
82
+ height: 40px;
83
+ border: 4px solid #f3f3f3;
84
+ border-top: 4px solid #5271FF;
85
+ border-radius: 50%;
86
  animation: spin 1s linear infinite;
87
  }
88
 
89
  @keyframes spin {
90
+ 0% { transform: rotate(0deg); }
91
+ 100% { transform: rotate(360deg); }
92
+ }
93
+
94
+ /* Включение лоадеров внутри контейнеров */
95
+ #loading-image {
96
+ z-index: 10; /* Вверху */
97
+ }
98
+
99
+ #loading-processed {
100
+ z-index: 10;
101
  }
102
 
103
+ #loading-model {
104
+ z-index: 10;
 
 
 
105
  }
106
 
107
  /* Button styling remains as original */
 
132
  width=400,
133
  height=300,
134
  )
135
+ loading_image = gr.HTML("<div id='loading-image' class='custom-loader'></div>")
136
+ loading_processed = gr.HTML("<div id='loading-processed' class='custom-loader'></div>")
137
+ loading_model = gr.HTML("<div id='loading-model' class='custom-loader'></div>")
138
+
139
 
140
  # Row 2: Processing options
141
  with gr.Row(elem_id="process-container"):