Spaces:
Runtime error
Runtime error
Commit
·
03f785d
1
Parent(s):
d231a79
Update streamlit_config.py
Browse files- streamlit_config.py +24 -22
streamlit_config.py
CHANGED
@@ -37,25 +37,27 @@ def run():
|
|
37 |
st.caption('Downloading Image...')
|
38 |
img_data = requests.get(img_url).content
|
39 |
with open('detect.jpg', 'wb') as file:
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
37 |
st.caption('Downloading Image...')
|
38 |
img_data = requests.get(img_url).content
|
39 |
with open('detect.jpg', 'wb') as file:
|
40 |
+
file.write(img_data)
|
41 |
+
file = Image('detect.jpg')
|
42 |
+
if not file:
|
43 |
+
return
|
44 |
+
|
45 |
+
placeholder = st.empty()
|
46 |
+
placeholder.info(
|
47 |
+
"Processing..."
|
48 |
+
)
|
49 |
+
|
50 |
+
image = process_file(file)
|
51 |
+
placeholder.empty()
|
52 |
+
placeholder.image(image)
|
53 |
+
|
54 |
+
filename = file.name
|
55 |
+
format = re.findall("\..*$", filename)[0][1:]
|
56 |
+
|
57 |
+
image = Image.fromarray(image)
|
58 |
+
|
59 |
+
buf = BytesIO()
|
60 |
+
image.save(buf, format="JPEG")
|
61 |
+
byte_image = buf.getvalue()
|
62 |
+
|
63 |
+
download_button(byte_image, filename, format)
|