Skip to content

Commit

Permalink
feat: update request methods and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ihmily committed Jun 14, 2024
1 parent 8d5abd6 commit 19604b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import cv2
import random
import gradio as gr
from gradio_client import Client
from gradio_client import Client, handle_file

machine_number = 0
model = os.path.join(os.path.dirname(__file__), "models/eva/Eva_0.png")
url = os.environ['OA_IP_ADDRESS']
print("API:", url)
client = Client(url)
client = Client("HumanAIGC/OutfitAnyone")

MODEL_MAP = {
"AI Model Rouyan_0": 'models/rouyan_new/Rouyan_0.png',
Expand Down Expand Up @@ -45,8 +43,10 @@ def get_tryon_result(model_name, garment1, garment2, seed=1234):
_model = "AI Model " + model_name.split("/")[-1].split(".")[0] # linux
print("Use Model:", _model)
seed = random.randint(0, 1222222222)
garment1 = handle_file(garment1) if garment1 else None
garment2 = handle_file(garment2) if garment2 else None
result = client.predict(
model_name,
handle_file(model_name),
garment1,
garment2,
api_name="/get_tryon_result",
Expand All @@ -66,7 +66,7 @@ def remove_watermark2(path):
x_start = max(int(0.3 * w), 0)
x_end = w

img_[y_start:y_end, x_start:x_end, :] = [255, 255, 255] # 白色 RGB 值为 [255, 255, 255]
img_[y_start:y_end, x_start:x_end, :] = [255, 255, 255]

return img_

Expand Down Expand Up @@ -172,4 +172,4 @@ def remove_watermark2(path):

if __name__ == "__main__":
demo.queue(max_size=10)
demo.launch(share=False, server_name='127.0.0.1', server_port=6006)
demo.launch(share=False, server_name='127.0.0.1', server_port=6006)
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
opencv-python
gradio==4.15.0
gradio-client==0.8.1
gradio==4.36.1
gradio-client==1.0.1

0 comments on commit 19604b0

Please sign in to comment.