o
    ;ήc                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	Z
d dlZddlmZ ddlmZ ddlmZ dd
edefddZdS )    N)redirect_stdout)Path)Type   )BaseSession)ClothSession)SimpleSessionu2net
model_namereturnc           	   	   C   s  d}d}t }| dkrd}d}t }n | dkrd}d}t }n| d	kr'd
}d}t}n
| dkr1d}d}t }tdtjtddd}|  d}t| }t| | }tj	|d| |t| dd t
 }dtjv ruttjd |_|| t
jt|t
 |dS )N 60024c5c889badc19c04ad937298a77bzHhttps://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnxu2netp 8e83ca70e441ab06c318d82300c84806zIhttps://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnxu2net_human_seg c09ddc2e0104f800e3e1bb4652583d1fzRhttps://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnxu2net_cloth_seg 2434d1f3cb744e0e49386c906e5a08bbzRhttps://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_cloth_seg.onnxsilueta 55e59e0d8062d2f5d013f4725ee84782zJhttps://github.com/danielgatis/rembg/releases/download/v0.0.0/silueta.onnx
U2NET_HOMEXDG_DATA_HOME~z.u2netz.onnxzmd5:T)fnamepathprogressbarOMP_NUM_THREADS)	providerssess_options)r   r   osgetenvr   joinr   
expanduserpoochretrieveortSessionOptionsenvironintinter_op_num_threadsInferenceSessionstrget_available_providers)	r
   md5urlsession_class
u2net_homer   r   	full_path	sess_opts r2   </tmp/pip-target-vg8gfxp4/lib/python/rembg/session_factory.pynew_session   sZ   


r4   )r	   )hashlibr   sys
contextlibr   pathlibr   typingr   onnxruntimer$   r"   session_baser   session_clothr   session_simpler   r*   r4   r2   r2   r2   r3   <module>   s    