Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Function to draw the plot
|
| 6 |
def draw_plot(length, width, unit):
|
|
@@ -50,11 +58,3 @@ if length and width:
|
|
| 50 |
file_name="plot_image.png",
|
| 51 |
mime="image/png"
|
| 52 |
)
|
| 53 |
-
|
| 54 |
-
# Convert the plot to bytes for download
|
| 55 |
-
def fig_to_bytes(fig):
|
| 56 |
-
import io
|
| 57 |
-
img_bytes = io.BytesIO()
|
| 58 |
-
fig.savefig(img_bytes, format="png")
|
| 59 |
-
img_bytes.seek(0)
|
| 60 |
-
return img_bytes.read()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import numpy as np
|
| 4 |
+
import io
|
| 5 |
+
|
| 6 |
+
# Convert the plot to bytes for download
|
| 7 |
+
def fig_to_bytes(fig):
|
| 8 |
+
img_bytes = io.BytesIO()
|
| 9 |
+
fig.savefig(img_bytes, format="png")
|
| 10 |
+
img_bytes.seek(0)
|
| 11 |
+
return img_bytes.read()
|
| 12 |
|
| 13 |
# Function to draw the plot
|
| 14 |
def draw_plot(length, width, unit):
|
|
|
|
| 58 |
file_name="plot_image.png",
|
| 59 |
mime="image/png"
|
| 60 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|