Skip to content

Commit

Permalink
[Feat] 웹 상에서 최종 결과 이미지 plotting #6
Browse files Browse the repository at this point in the history
- 웹에서 ladi 결과 이미지 출력
- __pycache__파일 github에서 삭제

related to: #7
  • Loading branch information
Hyunmin-H committed Jul 16, 2023
1 parent 2e5eab9 commit e2d8ce9
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 393 deletions.
Binary file removed backend/app/__pycache__/__main__.cpython-310.pyc
Binary file not shown.
Binary file removed backend/app/__pycache__/__main__.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed backend/app/__pycache__/main.cpython-310.pyc
Binary file not shown.
Binary file removed backend/app/__pycache__/main.cpython-38.pyc
Binary file not shown.
Binary file removed backend/app/__pycache__/model.cpython-310.pyc
Binary file not shown.
Binary file removed backend/app/__pycache__/model.cpython-38.pyc
Binary file not shown.
10 changes: 7 additions & 3 deletions backend/app/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ def main():
]
response = requests.post("http://localhost:8001/order", files=files)

label = response.json()["products"][0]["result"]
st.write(f'label is {label}')

# label = response.json()["products"][0]["result"]
# st.write(f'label is {label}')
category = 'lower_body'
output_ladi_buffer_dir = '/opt/ml/user_db/ladi/buffer'
final_result_dir = output_ladi_buffer_dir
final_img = Image.open(os.path.join(final_result_dir, f'{category}.png'))
st.image(final_img, caption='Final Image', use_column_width=True)

@cache_on_button_press('Authenticate')
def authenticate(password) -> bool:
Expand Down
17 changes: 7 additions & 10 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@
def hello_world():
return {"hello": "world"}


class Product(BaseModel):
id: UUID = Field(default_factory=uuid4)
name: str
price: float
result: Optional[List]


class Order(BaseModel):
id: UUID = Field(default_factory=uuid4)
products: List[Product] = Field(default_factory=list)
Expand Down Expand Up @@ -90,13 +93,6 @@ async def get_order(order_id: UUID) -> Union[Order, dict]:
def get_order_by_id(order_id: UUID) -> Optional[Order]:
return next((order for order in orders if order.id == order_id), None)

def convert_png_to_jpg(png_file, jpg_file):
# PNG 파일 열기
image = Image.open(png_file)

# JPG로 변환하기
image = image.convert("RGB")
image.save(jpg_file, "JPEG")

# post!!
@app.post("/order", description="주문을 요청합니다")
Expand Down Expand Up @@ -132,7 +128,6 @@ async def make_order(files: List[UploadFile] = File(...),
target_buffer_dir = f'{input_dir}/buffer/target'
main_schp(target_buffer_dir)



# openpose
output_openpose_buffer_dir = '/opt/ml/user_db/openpose/buffer'
Expand All @@ -144,13 +139,15 @@ async def make_order(files: List[UploadFile] = File(...),
db_dir = '/opt/ml/user_db'
os.makedirs(output_ladi_buffer_dir, exist_ok=True)
main_ladi(db_dir, output_ladi_buffer_dir)


return None
## return값
## output dir

inference_result = predict_from_image_byte(model=model, image_bytes=image_bytes, config=config)
product = InferenceImageProduct(result=inference_result)
products.append(product)


new_order = Order(products=products)
orders.append(new_order)
return new_order
Expand Down
Binary file not shown.
380 changes: 0 additions & 380 deletions model/ladi_vton/src/dataset/dresscode_modify.py

This file was deleted.

0 comments on commit e2d8ce9

Please sign in to comment.