Spaces:
Sleeping
Sleeping
Commit
·
1dbaff9
1
Parent(s):
63e0d46
debug
Browse files
app.py
CHANGED
|
@@ -142,7 +142,7 @@ def get_codebook_v2(quantizer):
|
|
| 142 |
return codes
|
| 143 |
|
| 144 |
def draw_fig_v2(ax, quantizer, data, title=""):
|
| 145 |
-
codes =
|
| 146 |
ax.scatter(data[:, 0], data[:, 1], s=60, marker="*")
|
| 147 |
ax.scatter(codes[:, 0], codes[:, 1], s=20, c='red', alpha=0.5)
|
| 148 |
ax.plot([-12, 12], [-12, 12], color='orange', linestyle='--', linewidth=2)
|
|
@@ -291,19 +291,6 @@ if __name__ == "__main__":
|
|
| 291 |
# description="Upload an image to see how different VQ models (BaseVQ, VQGAN, ReVQ) reconstruct it from latent codes."
|
| 292 |
# )
|
| 293 |
|
| 294 |
-
# demo2 = gr.Interface(
|
| 295 |
-
# fn=draw_reset_result, # 不再需要 handler 包装
|
| 296 |
-
# inputs=[
|
| 297 |
-
# gr.Slider(label="num_data", value=16, minimum=10, maximum=20, step=1),
|
| 298 |
-
# gr.Slider(label="num_code", value=12, minimum=8, maximum=16, step=1),
|
| 299 |
-
# ],
|
| 300 |
-
# outputs=[
|
| 301 |
-
# gr.Image(label="With Reset"),
|
| 302 |
-
# gr.Image(label="Without Reset")
|
| 303 |
-
# ],
|
| 304 |
-
# title="Demo 2: Codebook Reset Strategy Visualization",
|
| 305 |
-
# description="Visualizes codebook and data movement at different training steps."
|
| 306 |
-
# )
|
| 307 |
with gr.Blocks() as demo2:
|
| 308 |
gr.Markdown("## Demo 2: Codebook Reset Strategy Visualization")
|
| 309 |
gr.Markdown("Visualizes codebook and data movement at different training steps.")
|
|
|
|
| 142 |
return codes
|
| 143 |
|
| 144 |
def draw_fig_v2(ax, quantizer, data, title=""):
|
| 145 |
+
codes = get_codebook_v2(quantizer)
|
| 146 |
ax.scatter(data[:, 0], data[:, 1], s=60, marker="*")
|
| 147 |
ax.scatter(codes[:, 0], codes[:, 1], s=20, c='red', alpha=0.5)
|
| 148 |
ax.plot([-12, 12], [-12, 12], color='orange', linestyle='--', linewidth=2)
|
|
|
|
| 291 |
# description="Upload an image to see how different VQ models (BaseVQ, VQGAN, ReVQ) reconstruct it from latent codes."
|
| 292 |
# )
|
| 293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
with gr.Blocks() as demo2:
|
| 295 |
gr.Markdown("## Demo 2: Codebook Reset Strategy Visualization")
|
| 296 |
gr.Markdown("Visualizes codebook and data movement at different training steps.")
|