Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def plot_vectors(file):
|
|
35 |
|
36 |
# Save the plot to a buffer
|
37 |
buf = BytesIO()
|
38 |
-
plt.savefig(
|
39 |
buf.seek(0)
|
40 |
plt.close()
|
41 |
|
@@ -44,7 +44,7 @@ def plot_vectors(file):
|
|
44 |
img_str = base64.b64encode(buf.getvalue()).decode('utf-8')
|
45 |
|
46 |
# Return the base64-encoded image string
|
47 |
-
return
|
48 |
except Exception as e:
|
49 |
return str(e)
|
50 |
|
@@ -52,7 +52,7 @@ def plot_vectors(file):
|
|
52 |
iface = gr.Interface(
|
53 |
fn=plot_vectors,
|
54 |
inputs=gr.File(label="Upload a .npy file containing a 2D array of 1D vectors"),
|
55 |
-
outputs=gr.Image(type="
|
56 |
examples=[["random_array.npy"]] # Example file
|
57 |
)
|
58 |
|
|
|
35 |
|
36 |
# Save the plot to a buffer
|
37 |
buf = BytesIO()
|
38 |
+
plt.savefig("result.png")
|
39 |
buf.seek(0)
|
40 |
plt.close()
|
41 |
|
|
|
44 |
img_str = base64.b64encode(buf.getvalue()).decode('utf-8')
|
45 |
|
46 |
# Return the base64-encoded image string
|
47 |
+
return "result.png"
|
48 |
except Exception as e:
|
49 |
return str(e)
|
50 |
|
|
|
52 |
iface = gr.Interface(
|
53 |
fn=plot_vectors,
|
54 |
inputs=gr.File(label="Upload a .npy file containing a 2D array of 1D vectors"),
|
55 |
+
outputs=gr.Image(type="filepath", label="Visualization Result"),
|
56 |
examples=[["random_array.npy"]] # Example file
|
57 |
)
|
58 |
|