Spaces:
Sleeping
Sleeping
Commit
·
d16779f
1
Parent(s):
1de1417
Update app_v1.py
Browse files
app_v1.py
CHANGED
@@ -20,7 +20,7 @@ transform = transforms.Compose([
|
|
20 |
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
21 |
std=[0.229, 0.224, 0.225])
|
22 |
])
|
23 |
-
def predict_house_area(
|
24 |
total_area_sqm = 0
|
25 |
predicted_areas = []
|
26 |
|
@@ -35,9 +35,8 @@ def predict_house_area(room_id, excel_file, image_files):
|
|
35 |
worksheet = workbook.active
|
36 |
|
37 |
# Write the headers to the worksheet
|
38 |
-
worksheet.cell(row=1, column=1).value = "
|
39 |
-
worksheet.cell(row=1, column=2).value = "
|
40 |
-
worksheet.cell(row=1, column=3).value = "Predicted Area (sqm)"
|
41 |
|
42 |
# Get the last row index to append new data
|
43 |
last_row_index = worksheet.max_row if worksheet.max_row else 1
|
@@ -110,9 +109,8 @@ def predict_house_area(room_id, excel_file, image_files):
|
|
110 |
predicted_areas.append(predicted_area_sqm)
|
111 |
|
112 |
# Write the room ID, image file name, and predicted area to the worksheet
|
113 |
-
worksheet.cell(row=last_row_index + i + 1, column=1).value =
|
114 |
-
worksheet.cell(row=last_row_index + i + 1, column=2).value =
|
115 |
-
worksheet.cell(row=last_row_index + i + 1, column=3).value = predicted_area_sqm
|
116 |
|
117 |
# Save the workbook to a temporary file
|
118 |
temp_file = "predicted_areas.xlsx"
|
@@ -125,7 +123,6 @@ def predict_house_area(room_id, excel_file, image_files):
|
|
125 |
|
126 |
|
127 |
inputs = [
|
128 |
-
gr.inputs.Textbox(label = "Mã Phòng" , type = "text"),
|
129 |
gr.inputs.File(label="Excel File", type="file"),
|
130 |
gr.inputs.File(label="Images", type="file", file_count="multiple")
|
131 |
]
|
|
|
20 |
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
21 |
std=[0.229, 0.224, 0.225])
|
22 |
])
|
23 |
+
def predict_house_area(excel_file, image_files):
|
24 |
total_area_sqm = 0
|
25 |
predicted_areas = []
|
26 |
|
|
|
35 |
worksheet = workbook.active
|
36 |
|
37 |
# Write the headers to the worksheet
|
38 |
+
worksheet.cell(row=1, column=1).value = "Image File"
|
39 |
+
worksheet.cell(row=1, column=2).value = "Predicted Area (sqm)"
|
|
|
40 |
|
41 |
# Get the last row index to append new data
|
42 |
last_row_index = worksheet.max_row if worksheet.max_row else 1
|
|
|
109 |
predicted_areas.append(predicted_area_sqm)
|
110 |
|
111 |
# Write the room ID, image file name, and predicted area to the worksheet
|
112 |
+
worksheet.cell(row=last_row_index + i + 1, column=1).value = image_file_name
|
113 |
+
worksheet.cell(row=last_row_index + i + 1, column=2).value = predicted_area_sqm
|
|
|
114 |
|
115 |
# Save the workbook to a temporary file
|
116 |
temp_file = "predicted_areas.xlsx"
|
|
|
123 |
|
124 |
|
125 |
inputs = [
|
|
|
126 |
gr.inputs.File(label="Excel File", type="file"),
|
127 |
gr.inputs.File(label="Images", type="file", file_count="multiple")
|
128 |
]
|