UsmanGoraya commited on
Commit
41136ca
·
verified ·
1 Parent(s): 5400921

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -28,7 +28,8 @@ uploaded_file = st.file_uploader("Upload your DXF file", type=["dxf"])
28
  def extract_geometry(file_bytes):
29
  try:
30
  # Use BytesIO to read the uploaded file bytes properly
31
- doc = ezdxf.read(file_bytes)
 
32
  except Exception as e:
33
  st.error(f"Error reading DXF file: {e}")
34
  return [], 0.75, [], [], [], []
@@ -223,4 +224,4 @@ if uploaded_file is not None:
223
  st.download_button("Download Estimation PDF", f, file_name="estimation_report.pdf")
224
 
225
  except Exception as e:
226
- st.error(f"Error: {str(e)}")
 
28
  def extract_geometry(file_bytes):
29
  try:
30
  # Use BytesIO to read the uploaded file bytes properly
31
+ file_stream = BytesIO(file_bytes) # Convert bytes to a file-like object
32
+ doc = ezdxf.read(file_stream)
33
  except Exception as e:
34
  st.error(f"Error reading DXF file: {e}")
35
  return [], 0.75, [], [], [], []
 
224
  st.download_button("Download Estimation PDF", f, file_name="estimation_report.pdf")
225
 
226
  except Exception as e:
227
+ st.error(f"Error: {str(e)}")