Quinniboi10 commited on
Commit
03f785d
·
1 Parent(s): d231a79

Update streamlit_config.py

Browse files
Files changed (1) hide show
  1. 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
- if not file:
41
- return
42
-
43
- placeholder = st.empty()
44
- placeholder.info(
45
- "Processing..."
46
- )
47
-
48
- image = process_file(file)
49
- placeholder.empty()
50
- placeholder.image(image)
51
-
52
- filename = file.name
53
- format = re.findall("\..*$", filename)[0][1:]
54
-
55
- image = Image.fromarray(image)
56
-
57
- buf = BytesIO()
58
- image.save(buf, format="JPEG")
59
- byte_image = buf.getvalue()
60
-
61
- download_button(byte_image, filename, format)
 
 
 
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)