Spaces:
Running
on
Zero
Running
on
Zero
adjusted_pointsize
Browse files
app.py
CHANGED
|
@@ -433,6 +433,12 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
|
|
| 433 |
alpha=0.9, aspect='auto')
|
| 434 |
|
| 435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
# Time-based visualization
|
| 438 |
scatter_start = time.time()
|
|
@@ -444,7 +450,7 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
|
|
| 444 |
c=local_years,
|
| 445 |
cmap=colormaps.haline,
|
| 446 |
alpha=0.8,
|
| 447 |
-
s=
|
| 448 |
)
|
| 449 |
else:
|
| 450 |
years = pd.to_numeric(records_df['publication_year'])
|
|
@@ -454,7 +460,7 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
|
|
| 454 |
c=years,
|
| 455 |
cmap=colormaps.haline,
|
| 456 |
alpha=0.8,
|
| 457 |
-
s=
|
| 458 |
)
|
| 459 |
plt.colorbar(scatter, shrink=0.5, format='%d')
|
| 460 |
else:
|
|
@@ -463,7 +469,7 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
|
|
| 463 |
umap_embeddings[:,1],
|
| 464 |
c=records_df['color'],
|
| 465 |
alpha=0.8,
|
| 466 |
-
s=
|
| 467 |
)
|
| 468 |
print(f"Scatter plot creation completed in {time.time() - scatter_start:.2f} seconds")
|
| 469 |
|
|
|
|
| 433 |
alpha=0.9, aspect='auto')
|
| 434 |
|
| 435 |
|
| 436 |
+
if len(records_df) > 50_000:
|
| 437 |
+
point_size = .5
|
| 438 |
+
elif len(records_df) > 10_000:
|
| 439 |
+
point_size = 1
|
| 440 |
+
else:
|
| 441 |
+
point_size = 5
|
| 442 |
|
| 443 |
# Time-based visualization
|
| 444 |
scatter_start = time.time()
|
|
|
|
| 450 |
c=local_years,
|
| 451 |
cmap=colormaps.haline,
|
| 452 |
alpha=0.8,
|
| 453 |
+
s=point_size
|
| 454 |
)
|
| 455 |
else:
|
| 456 |
years = pd.to_numeric(records_df['publication_year'])
|
|
|
|
| 460 |
c=years,
|
| 461 |
cmap=colormaps.haline,
|
| 462 |
alpha=0.8,
|
| 463 |
+
s=point_size
|
| 464 |
)
|
| 465 |
plt.colorbar(scatter, shrink=0.5, format='%d')
|
| 466 |
else:
|
|
|
|
| 469 |
umap_embeddings[:,1],
|
| 470 |
c=records_df['color'],
|
| 471 |
alpha=0.8,
|
| 472 |
+
s=point_size
|
| 473 |
)
|
| 474 |
print(f"Scatter plot creation completed in {time.time() - scatter_start:.2f} seconds")
|
| 475 |
|