Bhushan26 commited on
Commit
c189866
·
verified ·
1 Parent(s): 99b29d8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -6
main.py CHANGED
@@ -5,7 +5,6 @@ import os
5
  import traceback
6
  import shutil
7
  import base64
8
- import asyncio
9
 
10
  app = Flask(__name__)
11
  CORS(app)
@@ -20,7 +19,7 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
20
  app.config['RESULT_FOLDER'] = RESULT_FOLDER
21
 
22
  @app.route('/process', methods=['POST'])
23
- async def predict():
24
  try:
25
  product_image_url = request.form.get('product_image_url')
26
 
@@ -40,10 +39,16 @@ async def predict():
40
  print("Product image = ", product_image_url)
41
  print("Model image = ", full_filename)
42
 
43
- loop = asyncio.get_event_loop()
44
- result = await loop.run_in_executor(None, client.predict, {
45
- "background": file(full_filename), "layers": [], "composite": None
46
- }, file(product_image_url), "Hello!!", True, False, 30, 42, "/tryon")
 
 
 
 
 
 
47
 
48
  print(result)
49
  output_image_path = result[0]
 
5
  import traceback
6
  import shutil
7
  import base64
 
8
 
9
  app = Flask(__name__)
10
  CORS(app)
 
19
  app.config['RESULT_FOLDER'] = RESULT_FOLDER
20
 
21
  @app.route('/process', methods=['POST'])
22
+ def predict():
23
  try:
24
  product_image_url = request.form.get('product_image_url')
25
 
 
39
  print("Product image = ", product_image_url)
40
  print("Model image = ", full_filename)
41
 
42
+ result = client.predict(
43
+ dict={"background": file(full_filename), "layers": [], "composite": None},
44
+ garm_img=file(product_image_url),
45
+ garment_des="Hello!!",
46
+ is_checked=True,
47
+ is_checked_crop=False,
48
+ denoise_steps=30,
49
+ seed=42,
50
+ api_name="/tryon"
51
+ )
52
 
53
  print(result)
54
  output_image_path = result[0]