rogerxavier commited on
Commit
da78506
1 Parent(s): f10e1e6

Update 1removeMask.py

Browse files
Files changed (1) hide show
  1. 1removeMask.py +1 -2
1removeMask.py CHANGED
@@ -55,7 +55,6 @@ def inpaint(img_path:str,mask_path:str)->"img content (resp.content)":
55
 
56
  # resp = requests.post("https://sanster-lama-cleaner-lama.hf.space/inpaint",data= payload,files=files)##huggingface版本
57
  resp = requests.post("https://sanster-lama-cleaner-lama.hf.space/inpaint", data=payload, files=files)
58
- print("lama去水印请求结果是",resp.text)
59
  return resp.content
60
 
61
  def save_img(img_content:"要处理的图片数据",new_save_path:"新文件的保存路径(包含后缀)",old_img_path:"旧文件路径")->"void生成新的文件保存 ,传入旧文件路径是为了删除有问题的旧文件":
@@ -66,7 +65,7 @@ def save_img(img_content:"要处理的图片数据",new_save_path:"新文件的
66
  img.save(new_save_path, format="JPEG")
67
  except Exception as e:
68
  #对于可能异常的图片->比如因为不合规导致resp.content没有正常返回
69
- print(e,new_save_path,"图片返回有问题,跳过并删除图片")
70
  os.remove(old_img_path)
71
 
72
 
 
55
 
56
  # resp = requests.post("https://sanster-lama-cleaner-lama.hf.space/inpaint",data= payload,files=files)##huggingface版本
57
  resp = requests.post("https://sanster-lama-cleaner-lama.hf.space/inpaint", data=payload, files=files)
 
58
  return resp.content
59
 
60
  def save_img(img_content:"要处理的图片数据",new_save_path:"新文件的保存路径(包含后缀)",old_img_path:"旧文件路径")->"void生成新的文件保存 ,传入旧文件路径是为了删除有问题的旧文件":
 
65
  img.save(new_save_path, format="JPEG")
66
  except Exception as e:
67
  #对于可能异常的图片->比如因为不合规导致resp.content没有正常返回
68
+ print(e,new_save_path,"图片返回有问题,跳过并删除图片.这里的路径是新保存路径")
69
  os.remove(old_img_path)
70
 
71