Dharini Baskaran commited on
Commit
74cd29b
·
1 Parent(s): 606611c

updating app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -56,9 +56,16 @@ cfg = write_config()
56
  def predict(uploaded_file):
57
  if uploaded_file is None:
58
  return None, None, "No file uploaded."
59
- uploaded_path = uploaded_file
60
- input_filename = os.path.basename(uploaded_path)
61
- print(f"✅ Image received at {uploaded_path}")
 
 
 
 
 
 
 
62
  # Save uploaded image
63
  # input_bytes = uploaded_file.read()
64
  # img = Image.open(BytesIO(input_bytes)).convert("RGB")
@@ -95,8 +102,8 @@ with gr.Blocks() as demo:
95
 
96
  with gr.Row():
97
  with gr.Column():
98
- uploaded_file = gr.File(label="Upload your Floorplan Image", type="filepath")
99
- # uploaded_file = gr.File(label="Upload your Floorplan Image", type="file")
100
  run_button = gr.Button("Run Vectorizer 🔥")
101
 
102
  with gr.Column():
 
56
  def predict(uploaded_file):
57
  if uploaded_file is None:
58
  return None, None, "No file uploaded."
59
+ # uploaded_path = uploaded_file
60
+ # input_filename = os.path.basename(uploaded_path)
61
+ # print(f"✅ Image received at {uploaded_path}")
62
+
63
+ uploaded_path = os.path.join(UPLOAD_DIR, uploaded_file.name)
64
+ with open(uploaded_path, "wb") as f:
65
+ f.write(uploaded_file.read())
66
+ print(f"✅ Image saved to {uploaded_path}")
67
+
68
+
69
  # Save uploaded image
70
  # input_bytes = uploaded_file.read()
71
  # img = Image.open(BytesIO(input_bytes)).convert("RGB")
 
102
 
103
  with gr.Row():
104
  with gr.Column():
105
+ # uploaded_file = gr.File(label="Upload your Floorplan Image", type="filepath")
106
+ uploaded_file = gr.File(label="Upload your Floorplan Image", type="file")
107
  run_button = gr.Button("Run Vectorizer 🔥")
108
 
109
  with gr.Column():