Spaces:
Sleeping
Sleeping
Update pilot_graph
Browse files- pilot_graph +5 -1
pilot_graph
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from PIL import Image
|
| 2 |
import io
|
| 3 |
import matplotlib.pyplot as plt
|
|
|
|
| 4 |
|
| 5 |
def plot_graph(self, G):
|
| 6 |
plt.figure(figsize=(3, 2))
|
|
@@ -13,6 +14,9 @@ def plot_graph(self, G):
|
|
| 13 |
plt.savefig(buf, format="png")
|
| 14 |
plt.close()
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
# Load the image from the buffer into a PIL Image
|
| 17 |
image = Image.open(buf)
|
| 18 |
-
return image
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
import io
|
| 3 |
import matplotlib.pyplot as plt
|
| 4 |
+
import networkx as nx
|
| 5 |
|
| 6 |
def plot_graph(self, G):
|
| 7 |
plt.figure(figsize=(3, 2))
|
|
|
|
| 14 |
plt.savefig(buf, format="png")
|
| 15 |
plt.close()
|
| 16 |
|
| 17 |
+
# Move to the beginning of the buffer before reading
|
| 18 |
+
buf.seek(0)
|
| 19 |
+
|
| 20 |
# Load the image from the buffer into a PIL Image
|
| 21 |
image = Image.open(buf)
|
| 22 |
+
return image
|