← back to Atmos Game
assets/gen/.venv/lib/python3.12/site-packages/gradio_client/__pycache__/client.cpython-312.pyc
616 lines
�
c�bjq � �� � d Z ddlmZ ddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlmZ ddlmZmZ ddlmZ ddlmZ ddlmZ dd lmZ dd
lm Z ddl!m"Z" ddlm#Z# dd
l$m%Z%m&Z& ddl'Z'ddl(Z(ddl(m)Z)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z: ddl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZC e j� j� d� xs eF e" e
j� � � dz � ZH e6dddd� G d� d� � ZIe G d� d� � ZJe G d � d!� � ZK G d"� d#� ZL e6d$d%d&� G d'� d(e� � ZMy))z,The main Client class for the Python client.� )�annotationsN)�deque)�AsyncGenerator�Callable)�Future)�copy_context)� dataclass)�datetime)�partial)�Path)�Lock)�Any�Literal)�
SpaceHardware�
SpaceStage)�RepositoryNotFoundError�build_hf_headers�send_telemetry)�version)�utils)�
ParameterInfo)�document)�AppError�AuthenticationError�ValidationError)�Communicator� JobStatus�Message�
QueueError�
ServerMessage�Status�StatusUpdate�Update�GRADIO_TEMP_DIR�gradio�predict�submit�view_api� duplicatec � � e Zd ZdZ ddedddd� dd�Zd� Zd� Z d d�Zd � Z e
d! d"d
�� Zd� Zdddd� d#d
�Z
d$ d%d�Zddddd� d&d�Zd� Z d' d(d�Zd)d�Zd*d�Z d+d�Zd� Zd� Zd)d�Zd,d�Zd� Zd-d�Zd.d�Zd/d�Zy)0�Clienta�
The main Client class for the Python client. This class is used to connect to a remote Gradio app and call its API endpoints.
Example:
from gradio_client import Client
client = Client("abidlabs/whisper-large-v2") # connecting to a Hugging Face Space
client.predict("test.mp4", api_name="/predict")
>> What a nice recording! # returns the result of the remote API call
client = Client("https://bec81a83-5b5c-471e.gradio.live") # connecting to a temporary Gradio share URL
job = client.submit("hello", api_name="/predict") # runs the prediction in a background thread
job.result()
>> 49 # returns the result of the remote API call (blocking call)
NT)�headers�download_files�
ssl_verify�_skip_components�analytics_enabledc �D � || _ || _ || _ |
| _ t |dt
j �� | _ d| j v r)| j d | j d<