Spaces:
Sleeping
Sleeping
Delete graphs.py
Browse files
graphs.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
import matplotlib.pyplot as plt
|
| 2 |
-
import tempfile
|
| 3 |
-
import os
|
| 4 |
-
import uuid #helps generate temporary random ids for storing graphs with unique names randomly and save them
|
| 5 |
-
|
| 6 |
-
def create_graphs(chunk_lengths, retrieved_len, summary_len, stage_times):
|
| 7 |
-
temp_dir = tempfile.gettempdir()
|
| 8 |
-
uid = str(uuid.uuid4())
|
| 9 |
-
|
| 10 |
-
# Graph 1
|
| 11 |
-
plt.figure()
|
| 12 |
-
plt.bar(stage_times.keys(), stage_times.values())
|
| 13 |
-
plt.title("Pipeline Stage Execution Time")
|
| 14 |
-
g1 = os.path.join(temp_dir, f"g1_{uid}.png")
|
| 15 |
-
plt.savefig(g1)
|
| 16 |
-
plt.close()
|
| 17 |
-
|
| 18 |
-
# Graph 2
|
| 19 |
-
plt.figure()
|
| 20 |
-
plt.hist(chunk_lengths, bins=20)
|
| 21 |
-
plt.title("Chunk Length Distribution")
|
| 22 |
-
g2 = os.path.join(temp_dir, f"g2_{uid}.png")
|
| 23 |
-
plt.savefig(g2)
|
| 24 |
-
plt.close()
|
| 25 |
-
|
| 26 |
-
# Graph 3
|
| 27 |
-
plt.figure()
|
| 28 |
-
plt.bar(["Retrieved", "Summary"], [retrieved_len, summary_len])
|
| 29 |
-
plt.title("Retrieved vs Summary Length")
|
| 30 |
-
g3 = os.path.join(temp_dir, f"g3_{uid}.png")
|
| 31 |
-
plt.savefig(g3)
|
| 32 |
-
plt.close()
|
| 33 |
-
|
| 34 |
-
return g1, g2, g3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|