app first
Browse files
app.py
CHANGED
|
@@ -1,7 +1,65 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import pickle
|
| 4 |
|
| 5 |
+
# 모델 로딩 함수
|
| 6 |
+
def load_model():
|
| 7 |
+
with open("model.pkl", "rb") as file:
|
| 8 |
+
loaded_pipeline = pickle.load(file)
|
| 9 |
+
return loaded_pipeline
|
| 10 |
|
| 11 |
+
# 예측 함수 정의
|
| 12 |
+
def predict(construction_type, underground_floors, aboveground_floors, total_area,
|
| 13 |
+
land_area, building_area, landscape_area, parking_lot_count, order_year,
|
| 14 |
+
order_month, construction_period, location, building_purpose):
|
| 15 |
+
|
| 16 |
+
new_project = {
|
| 17 |
+
'구조': [construction_type],
|
| 18 |
+
'지하층수': [underground_floors],
|
| 19 |
+
'지상층수': [aboveground_floors],
|
| 20 |
+
'연면적': [total_area],
|
| 21 |
+
'대지면적': [land_area],
|
| 22 |
+
'건축면적': [building_area],
|
| 23 |
+
'조경면적': [landscape_area],
|
| 24 |
+
'주차수': [parking_lot_count],
|
| 25 |
+
'발주년': [order_year],
|
| 26 |
+
'발주월': [order_month],
|
| 27 |
+
'공사기간': [construction_period],
|
| 28 |
+
'현장위치': [location],
|
| 29 |
+
'건축법상용도': [building_purpose],
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
model = load_model()
|
| 33 |
+
prediction = model.predict(pd.DataFrame.from_dict(new_project))
|
| 34 |
+
return prediction[0].tolist()
|
| 35 |
+
|
| 36 |
+
# Gradio 인터페이스 생성
|
| 37 |
+
iface = gr.Interface(
|
| 38 |
+
fn=predict,
|
| 39 |
+
inputs=[
|
| 40 |
+
gr.Textbox(label="구조"),
|
| 41 |
+
gr.Number(label="지하층수"),
|
| 42 |
+
gr.Number(label="지상층수"),
|
| 43 |
+
gr.Number(label="연면적(m2)"),
|
| 44 |
+
gr.Number(label="대지면적(m2)"),
|
| 45 |
+
gr.Number(label="건축면적(m2)"),
|
| 46 |
+
gr.Number(label="조경면적(m2)"),
|
| 47 |
+
gr.Number(label="주차대수"),
|
| 48 |
+
gr.Number(label="발주년도"),
|
| 49 |
+
gr.Dropdown(range(1, 13), label="발주월"),
|
| 50 |
+
gr.Number(label="공사기간(일))"),
|
| 51 |
+
gr.Textbox(label="현장위치(도/시)"),
|
| 52 |
+
gr.Textbox(label="건축법상용도")
|
| 53 |
+
],
|
| 54 |
+
outputs=[
|
| 55 |
+
gr.Textbox(label="건축공사비"),
|
| 56 |
+
gr.Textbox(label="기계공사비"),
|
| 57 |
+
gr.Textbox(label="전기공사비"),
|
| 58 |
+
gr.Textbox(label="통신공사비"),
|
| 59 |
+
gr.Textbox(label="토목공사비"),
|
| 60 |
+
gr.Textbox(label="조경공사비")
|
| 61 |
+
]
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# Gradio 앱을 실행합니다.
|
| 65 |
iface.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5eb90256b7690b0e93fb6bd45d0cb3e4c5fc3b2544449b5bb8be09dbe41ea511
|
| 3 |
+
size 10257142
|