repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/sync_frontend.py
scripts/sync_frontend.py
from __future__ import annotations import json import pathlib from huggingface_hub import upload_folder def copy_js_code(root: str | pathlib.Path, hf_token: str | None = None): NOT_COMPONENT = [ "app", "node_modules", "storybook", "playwright-report", "workbench", ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/upload_website_demos.py
scripts/upload_website_demos.py
from __future__ import annotations import argparse import json import os import pathlib import shutil import tempfile import textwrap import time import warnings import huggingface_hub import requests ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) DIR = os.path.dirname(__file__) GRADIO_DEMO_DI...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/upload_docs_json.py
scripts/upload_docs_json.py
import json import re from pathlib import Path from subprocess import run import html2text from bs4 import BeautifulSoup from huggingface_hub import HfApi api = HfApi() def obj_divs_to_markdown(html: str) -> str: soup = BeautifulSoup(html, "html.parser") objs = soup.select("div.obj") if not objs: ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/benchmark_latency_mcp.py
scripts/benchmark_latency_mcp.py
import asyncio import time from mcp import ClientSession from mcp.client.streamable_http import streamablehttp_client import gradio as gr SHOW_RESULTS = False with gr.Blocks() as demo: input = gr.Textbox(label="Input") output = gr.Textbox(label="Output") def double(word: str) -> str: return word...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/format_release_notes.py
scripts/format_release_notes.py
import argparse import pathlib import textwrap current_dir = (pathlib.Path(__file__).parent / "..").resolve() TEMPLATE = """# Upcoming Release ## New Features: No changes to highlight. ## Bug Fixes: No changes to highlight. ## Other Changes: No changes to highlight. ## Breaking Changes: No changes to highlight. ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/benchmark_latency_api.py
scripts/benchmark_latency_api.py
import time import gradio as gr from gradio_client import Client import threading SHOW_RESULTS = False with gr.Blocks() as demo: input = gr.Textbox(label="Input") output = gr.Textbox(label="Output") input.change(lambda x: x*2, input, output) _, url, _ = demo.launch(prevent_thread_lock=True) client = Cli...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/upload_demo_to_space.py
scripts/upload_demo_to_space.py
import argparse import pathlib import shutil import sys import tempfile import textwrap from typing import Optional from huggingface_hub import CommitOperationAdd, HfApi def upload_demo_to_space( demo_name: str, space_id: str, hf_token: str, gradio_version: Optional[str] ): """ Upload a demo from the dem...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/copy_demos.py
scripts/copy_demos.py
""" We pull in a select number of spaces and build them into a single FastAPI application to preview them on HF Spaces. The script that is run in CI is located at: https://github.com/gradio-app/github/blob/main/packages/copy-demos/index.ts This is the Python version of that script for local use. """ import argparse im...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/generate_theme.py
scripts/generate_theme.py
import argparse from gradio import themes parser = argparse.ArgumentParser( description="Generate themed CSS which is normally served from the /theme.css endpoint of a Gradio server." ) parser.add_argument( "--outfile", type=argparse.FileType("w", encoding="latin-1"), default="-" ) parser.add_argument( "-...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/generate_notebooks.py
scripts/generate_notebooks.py
import json import os import random import subprocess from pathlib import Path import nbformat as nbf GRADIO_DEMO_DIR = Path.cwd() / "demo" DEMOS_TO_SKIP = {"all_demos", "reset_components", "custom_path", "kitchen_sink_random"} demos = os.listdir(GRADIO_DEMO_DIR) demos = [ demo for demo in demos if demo ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/load_test/gradio_app.py
scripts/load_test/gradio_app.py
from time import sleep import gradio as gr version, _, _ = gr.__version__.split(".") with gr.Blocks() as demo: chatbot = gr.Chatbot() text = gr.Textbox() time = gr.Number(label="Time to Complete") def respond(text): output = ["Lorem"] * 500 for i in range(len(output) + 1): ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/load_test/workers.py
scripts/load_test/workers.py
from __future__ import annotations import asyncio import uuid from dataclasses import dataclass from typing import Callable from fastapi import FastAPI, WebSocket from fastapi.responses import StreamingResponse from pydantic import BaseModel app = FastAPI() @dataclass class Event: session_id: str data: str...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/scripts/load_test/simple.py
scripts/load_test/simple.py
import asyncio from fastapi import FastAPI, WebSocket from fastapi.responses import StreamingResponse app = FastAPI() async def number_generator(): for number in range(1, 501): message = "Lorem " * (number + 1) yield f"data: {message}\n\n" await asyncio.sleep(0.01) @app.get("/sse") asy...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/.config/pycompile-lite-wheel.py
.config/pycompile-lite-wheel.py
import subprocess from hatchling.builders.hooks.plugin.interface import BuildHookInterface class BuildHook(BuildHookInterface): def finalize(self, version, build_data, artifact_path): subprocess.run(["pyodide", "py-compile", "--keep", artifact_path], check=True)
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_components.py
test/test_components.py
import inspect import os import numpy as np import pandas as pd import pytest from gradio_client import utils as client_utils from gradio_pdf import PDF import gradio as gr from gradio import processing_utils from gradio.components.base import Component from gradio.data_classes import GradioModel, GradioRootModel fro...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_custom_component_compatibility.py
test/test_custom_component_compatibility.py
""" This suite of tests is designed to ensure compatibility between the current version of Gradio with custom components created using the previous version of Gradio. """ from pathlib import Path from gradio_pdf import PDF def test_processing_utils_backwards_compatibility(): pdf_component = PDF() cached_pdf...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_queueing.py
test/test_queueing.py
import time import gradio_client as grc import pytest from fastapi.testclient import TestClient import gradio as gr from gradio.route_utils import API_PREFIX class TestQueueing: def test_single_request(self, connect): with gr.Blocks() as demo: name = gr.Textbox() output = gr.Text...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_external.py
test/test_external.py
import os import tempfile import textwrap from pathlib import Path from unittest.mock import MagicMock, patch import huggingface_hub import pytest import gradio as gr from gradio.context import Context from gradio.exceptions import GradioVersionIncompatibleError, InvalidApiNameError from gradio.external import TooMan...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_analytics.py
test/test_analytics.py
import json import os import warnings from unittest.mock import patch from gradio import analytics os.environ["GRADIO_ANALYTICS_ENABLED"] = "False" class TestAnalytics: @patch("httpx.get") def test_should_warn_with_unable_to_parse(self, mock_get, monkeypatch): monkeypatch.setenv("GRADIO_ANALYTICS_EN...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_routes.py
test/test_routes.py
"""Contains tests for networking.py and app.py""" import functools import inspect import json import os import pickle import tempfile import time from contextlib import asynccontextmanager, closing from pathlib import Path from threading import Thread import gradio_client as grc import httpx import numpy as np import...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
true
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_processing_utils.py
test/test_processing_utils.py
import os import shutil import tempfile from pathlib import Path from unittest.mock import patch import ffmpy import numpy as np import pytest from PIL import Image, ImageCms from gradio import components, data_classes, processing_utils, utils from gradio.route_utils import API_PREFIX class TestTempFileManagement: ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_image_utils.py
test/test_image_utils.py
from gradio.image_utils import extract_svg_content def test_extract_svg_content_local_file(): svg_path = "test/test_files/file_icon.svg" svg_content = extract_svg_content(svg_path) assert ( svg_content == '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" f...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_networking.py
test/test_networking.py
"""Contains tests for networking.py and app.py""" import http.server import os import socket import socketserver import threading import time import urllib.error import urllib.parse import urllib.request import requests import uvicorn from fastapi import FastAPI from fastapi.testclient import TestClient from gradio ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_http_server.py
test/test_http_server.py
import urllib.parse import pytest import gradio as gr from gradio import http_server, routes class TestStartServer: # Test IPv4 and IPv6 hostnames as they would be passed from --server-name. @pytest.mark.parametrize("host", ["127.0.0.1", "[::1]"]) def test_start_server(self, host): io = gr.Inter...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_blocks.py
test/test_blocks.py
import asyncio import copy import io import json import os import pathlib import random import sys import threading import time import uuid import warnings from concurrent.futures import wait from contextlib import contextmanager from functools import partial from string import capwords from unittest.mock import mock_o...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
true
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_buttons.py
test/test_buttons.py
from unittest.mock import patch import pytest import gradio as gr class TestClearButton: def test_clear_event_setup_correctly(self): with gr.Blocks() as demo: chatbot = gr.Chatbot( # type: ignore [ # type: ignore {"content": "Hello", "role": "user"}, ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_component_props.py
test/test_component_props.py
"""Tests for the component props feature.""" import gradio as gr from gradio import helpers def test_special_args_detects_component_type_hints(): """Test that special_args detects when a parameter is type-hinted with a component.""" def func_with_component_hint(x: gr.Number): return x.value * 2 ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_mcp.py
test/test_mcp.py
import copy import json import os import tempfile import pytest from mcp import ClientSession from mcp.client.streamable_http import streamablehttp_client from PIL import Image from starlette.requests import Request import gradio as gr from gradio.data_classes import FileData from gradio.mcp import GradioMCPServer ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_reload.py
test/test_reload.py
import dataclasses from pathlib import Path import pytest import gradio as gr from gradio.cli.commands.reload import _setup_config from gradio.http_server import Server def build_demo(): with gr.Blocks() as demo: gr.Textbox("") return demo @dataclasses.dataclass class Config: module_name: str...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_utils.py
test/test_utils.py
from __future__ import annotations import json import os import sys import warnings from collections.abc import Sequence from pathlib import Path from typing import Literal from unittest.mock import patch import numpy as np import pytest from gradio_client.exceptions import AppError from hypothesis import given, sett...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_chat_interface.py
test/test_chat_interface.py
import tempfile import warnings from concurrent.futures import wait from pathlib import Path from unittest.mock import patch import pytest from gradio_client import handle_file import gradio as gr from gradio.components.chatbot import Message, TextMessage def invalid_fn(message): return message def double(mes...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_pipelines.py
test/test_pipelines.py
import unittest from unittest.mock import MagicMock import pytest import transformers from diffusers import ( StableDiffusionDepth2ImgPipeline, # type: ignore StableDiffusionImageVariationPipeline, # type: ignore StableDiffusionImg2ImgPipeline, # type: ignore StableDiffusionInpaintPipeline, # type:...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_theme_sharing.py
test/test_theme_sharing.py
import tempfile from unittest.mock import patch import httpx import huggingface_hub import pytest from huggingface_hub.hf_api import SpaceInfo import gradio as gr from gradio.themes.utils import ThemeAsset, get_matching_version, get_theme_assets versions = [ "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_interfaces.py
test/test_interfaces.py
import io import sys from contextlib import contextmanager from functools import partial from string import capwords from unittest.mock import MagicMock, patch import httpx import pytest import gradio from gradio.blocks import Blocks from gradio.components import Image, Textbox from gradio.interface import Interface,...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_flagging.py
test/test_flagging.py
import os import pathlib import tempfile from unittest.mock import MagicMock import pytest import gradio as gr from gradio import flagging os.environ["GRADIO_ANALYTICS_ENABLED"] = "False" class TestDefaultFlagging: def test_default_flagging_callback(self): with tempfile.TemporaryDirectory() as tmpdirna...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/conftest.py
test/conftest.py
import inspect import pathlib from contextlib import contextmanager import pytest from gradio_client import Client import gradio as gr import gradio.utils def pytest_configure(config): config.addinivalue_line( "markers", "flaky: mark test as flaky. Failure will not cause te" ) @pytest.fixture def ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_external_utils.py
test/test_external_utils.py
from unittest.mock import MagicMock, patch import pytest import gradio as gr from gradio.external_utils import ( component_from_parameter_schema, component_from_request_body_schema, create_endpoint_fn, resolve_schema_ref, ) @pytest.mark.parametrize( "param_info,expected_type", [ ({"n...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_gradio_component_cli.py
test/test_gradio_component_cli.py
import shutil import textwrap from pathlib import Path import pytest from gradio.cli.commands.components.build import _build from gradio.cli.commands.components.create import _create, _create_utils from gradio.cli.commands.components.install_component import _get_executable_path from gradio.cli.commands.components.pu...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_api_info.py
test/test_api_info.py
from collections import namedtuple from datetime import datetime, timedelta from enum import Enum from pathlib import Path from typing import ClassVar, Literal, Union from uuid import UUID import pytest from gradio_client.utils import json_schema_to_python_type from pydantic import Field from pydantic.networks import ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/__init__.py
test/__init__.py
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_tunneling.py
test/test_tunneling.py
import sys import pytest from gradio import Interface, networking pytestmark = pytest.mark.skipif( sys.platform == "win32", reason="Skipped on Windows as Windows CI doesn't support tunneling", ) @pytest.mark.flaky def test_setup_tunnel(): io = Interface(lambda x: x, "number", "number") io.launch(sh...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_helpers.py
test/test_helpers.py
import asyncio import os import tempfile import time from pathlib import Path from unittest.mock import patch import gradio_client as grc import pytest from gradio_client import utils as client_utils from pydub import AudioSegment from starlette.testclient import TestClient from tqdm import tqdm import gradio as gr f...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_events.py
test/test_events.py
import ast import inspect from pathlib import Path import pytest from fastapi.testclient import TestClient import gradio as gr class TestEvent: def test_clear_event(self): def fn_img_cleared(): print("image cleared") with gr.Blocks() as demo: img = gr.Image( ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_dialogue.py
test/components/test_dialogue.py
import gradio as gr from gradio.components.dialogue import DialogueLine, DialogueModel class TestDialogue: def test_component_functions(self): """ Test preprocess, postprocess, and basic functionality """ dialogue = gr.Dialogue(speakers=["Speaker 1", "Speaker 2"]) dialogue...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_gallery.py
test/components/test_gallery.py
from pathlib import Path import numpy as np import PIL import gradio as gr from gradio.components.gallery import GalleryImage from gradio.data_classes import ImageData class TestGallery: def test_postprocess(self): url = "https://huggingface.co/Norod78/SDXL-VintageMagStyle-Lora/resolve/main/Examples/000...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_button.py
test/components/test_button.py
import gradio as gr class TestButton: def test_postprocess(self): assert gr.Button().postprocess("5") == "5" assert gr.Button().postprocess(5) == "5" # type: ignore
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_textbox.py
test/components/test_textbox.py
import pytest import gradio as gr class TestTextbox: def test_component_functions(self): """ Preprocess, postprocess, serialize, tokenize, get_config """ text_input = gr.Textbox() assert text_input.preprocess("Hello World!") == "Hello World!" assert text_input.post...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_datetime.py
test/components/test_datetime.py
from datetime import datetime, timezone import gradio as gr class TestDateTime: def test_component_functions(self): """ Preprocess, postprocess """ def within_range(time1, time2, delta=30): return abs(time1 - time2) < delta dt = gr.DateTime(timezone="US/Pacif...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_file.py
test/components/test_file.py
import os from pathlib import Path import pytest import gradio as gr from gradio.data_classes import FileData, ListFiles class TestFile: def test_component_functions(self, media_data): """ Preprocess, serialize, get_config, value """ x_file = FileData(path=media_data.BASE64_FILE[...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_checkbox_group.py
test/components/test_checkbox_group.py
import pytest import gradio as gr class TestCheckboxGroup: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ checkboxes_input = gr.CheckboxGroup(["a", "b", "c"]) assert checkboxes_input.preprocess(["a", "c"]) == ["a", "c"] a...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_html.py
test/components/test_html.py
import gradio as gr class TestHTML: def test_component_functions(self): """ get_config """ html_component = gr.components.HTML("#Welcome onboard", label="HTML Input") assert html_component.get_config() == { "_retryable": False, "_selectable": False, ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_annotated_image.py
test/components/test_annotated_image.py
import numpy as np import PIL import gradio as gr class TestAnnotatedImage: def test_postprocess(self): """ postprocess """ component = gr.AnnotatedImage() img = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8) mask1 = [40, 40, 50, 50] mask2 = np.ze...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_image_editor.py
test/components/test_image_editor.py
import gradio as gr from gradio.components.image_editor import EditorData, EditorValue from gradio.data_classes import FileData class TestImageEditor: def test_component_functions(self): test_image_path = "test/test_files/bus.png" image_data = FileData(path=test_image_path) image_editor_da...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_color_picker.py
test/components/test_color_picker.py
import gradio as gr class TestColorPicker: def test_component_functions(self): """ Preprocess, postprocess, serialize, tokenize, get_config """ color_picker_input = gr.ColorPicker() assert color_picker_input.preprocess("#000000") == "#000000" assert color_picker_inp...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_file_explorer.py
test/components/test_file_explorer.py
from pathlib import Path import pytest import gradio as gr from gradio.components.file_explorer import FileExplorerData from gradio.exceptions import InvalidPathError class TestFileExplorer: def test_component_functions(self): """ Preprocess, get_config """ file_explorer = gr.Fil...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_json.py
test/components/test_json.py
import json import numpy as np import pytest import gradio as gr class TestJSON: def test_component_functions(self): """ Postprocess """ js_output = gr.JSON() assert js_output.postprocess('{"a":1, "b": 2}'), '"{\\"a\\":1, \\"b\\": 2}"' assert js_output.get_config(...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/plot_data.py
test/components/plot_data.py
from datetime import datetime, timedelta import pandas as pd import vega_datasets barley = vega_datasets.data.barley() simple = pd.DataFrame( { "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"], "b": [28, 55, 43, 91, 81, 53, 19, 87, 52], "c": [0] * 9, "date": [datetime.now() - tim...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_native_plots.py
test/components/test_native_plots.py
import gradio as gr from .plot_data import barley, simple class TestNativePlot: def test_plot_recognizes_correct_datatypes(self): plot = gr.BarPlot( value=simple, x="date", y="b", ) assert plot.value["datatypes"]["date"] == "temporal" assert plo...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_video.py
test/components/test_video.py
import os import shutil import tempfile from copy import deepcopy from pathlib import Path from unittest.mock import MagicMock, patch import pytest import gradio as gr from gradio import processing_utils from gradio.data_classes import FileData class TestVideo: @pytest.mark.asyncio async def test_component_...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_upload_button.py
test/components/test_upload_button.py
import pytest import gradio as gr from gradio.data_classes import FileData, ListFiles class TestUploadButton: def test_component_functions(self, media_data): """ preprocess """ x_file = FileData(path=media_data.BASE64_FILE["path"]) upload_input = gr.UploadButton() ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_audio.py
test/components/test_audio.py
import filecmp from copy import deepcopy from difflib import SequenceMatcher from pathlib import Path import numpy as np import pytest from gradio_client import utils as client_utils import gradio as gr from gradio import processing_utils, utils from gradio.data_classes import FileData from gradio.media import get_au...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_highlighted_text.py
test/components/test_highlighted_text.py
import gradio as gr class TestHighlightedText: def test_postprocess(self): """ postprocess """ component = gr.HighlightedText() value = [ ("", None), ("Wolfgang", "PER"), (" lives in ", None), ("Berlin", "LOC"), ("...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_state.py
test/components/test_state.py
import pytest from pydantic import BaseModel import gradio as gr class TestModel(BaseModel): name: str class TestState: def test_as_component(self): state = gr.State(value=5) assert state.preprocess(10) == 10 assert state.preprocess("abc") == "abc" assert state.stateful ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_chatbot.py
test/components/test_chatbot.py
import gradio as gr from gradio import utils class TestChatbot: def test_component_functions(self): """ Postprocess, get_config """ chatbot = gr.Chatbot() assert chatbot.postprocess( # type: ignore [ # type: ignore {"role": "user", "content": "...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_dropdown.py
test/components/test_dropdown.py
import pytest import gradio as gr class TestDropdown: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ dropdown_input = gr.Dropdown(["a", "b", ("c", "c full")], multiselect=True) assert dropdown_input.preprocess("a") == "a" ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_label.py
test/components/test_label.py
from pathlib import Path import numpy as np import pytest import gradio as gr from gradio import FileData class TestLabel: def test_component_functions(self): """ Process, postprocess, deserialize """ y = "happy" label_output = gr.Label() label = label_output.post...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_image.py
test/components/test_image.py
from pathlib import Path from typing import cast import numpy as np import PIL import pytest from gradio_client import utils as client_utils import gradio as gr from gradio.components.image import ImageData # type: ignore from gradio.exceptions import Error from gradio.media import get_image class TestImage: d...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_markdown.py
test/components/test_markdown.py
import gradio as gr class TestMarkdown: def test_component_functions(self): markdown_component = gr.Markdown("# Let's learn about $x$", label="Markdown") assert markdown_component.get_config()["value"] == "# Let's learn about $x$" assert not markdown_component.get_config()["buttons"] ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_dataframe.py
test/components/test_dataframe.py
from datetime import datetime import numpy as np import pandas as pd import polars as pl import pytest import gradio as gr from gradio.components.dataframe import DataframeData class TestDataframe: def test_component_functions(self): """ Preprocess, serialize, get_config """ x_da...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_checkbox.py
test/components/test_checkbox.py
import gradio as gr class TestCheckbox: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ bool_input = gr.Checkbox() assert bool_input.preprocess(True) assert bool_input.postprocess(True) assert bool_input.postprocess...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/__init__.py
test/components/__init__.py
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_download_button.py
test/components/test_download_button.py
import gradio as gr def test_download_button_sets_origname(): value = gr.DownloadButton().postprocess("/home/image.png") assert value.orig_name == "image.png" # type: ignore
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_plot.py
test/components/test_plot.py
import pytest import gradio as gr from gradio import utils class TestPlot: @pytest.mark.asyncio async def test_in_interface_as_output(self): """ Interface, process """ def plot(num): import matplotlib.pyplot as plt fig = plt.figure() plt.p...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_code.py
test/components/test_code.py
from pathlib import Path import gradio as gr class TestCode: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ code = gr.Code() assert code.preprocess("# hello friends") == "# hello friends" assert code.preprocess("def fn(a...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_model3d.py
test/components/test_model3d.py
from pathlib import Path import gradio as gr class TestModel3D: def test_component_functions(self): """ get_config """ model_component = gr.components.Model3D(None, label="Model") assert model_component.get_config() == { "value": None, "display_mode...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_radio.py
test/components/test_radio.py
import pytest import gradio as gr class TestRadio: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ radio_input = gr.Radio(["a", "b", "c"]) assert radio_input.preprocess("c") == "c" assert radio_input.postprocess("a") == "...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_dataset.py
test/components/test_dataset.py
from pathlib import Path from unittest.mock import patch import numpy as np import pandas as pd import gradio as gr class TestDataset: def test_preprocessing(self): test_file_dir = Path(__file__).parent / "test_files" bus = str(Path(test_file_dir, "bus.png").resolve()) dataset = gr.Data...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_number.py
test/components/test_number.py
import pytest import gradio as gr class TestNumber: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ numeric_input = gr.Number(elem_id="num", elem_classes="first") assert numeric_input.preprocess(3) == 3.0 assert numeric_i...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/components/test_slider.py
test/components/test_slider.py
from unittest.mock import patch import pytest import gradio as gr class TestSlider: def test_component_functions(self): """ Preprocess, postprocess, serialize, get_config """ slider_input = gr.Slider() assert slider_input.preprocess(3.0) == 3.0 assert slider_input...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/conftest.py
test/test_docker/conftest.py
import os import shutil import subprocess import time import docker import pytest import requests from docker.errors import NotFound from requests.exceptions import ConnectionError, RequestException @pytest.fixture(scope="session", autouse=True) def build_packages(): file_dir = os.path.dirname(os.path.abspath(__...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/app.py
test/test_docker/app.py
import gradio as gr demo = gr.Interface(lambda x: f"Hi {x}", "textbox", "textbox") demo.launch(server_name="0.0.0.0", server_port=8000)
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy_fastapi_mount/test_reverse_proxy_fastapi_mount.py
test/test_docker/test_reverse_proxy_fastapi_mount/test_reverse_proxy_fastapi_mount.py
import os import random import re import sys import gradio_client import pytest import requests TEST_NAME = "reverse_proxy_fastapi_mount" folder = os.path.dirname(os.path.abspath(__file__)) pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="Skipped on Windows") @pytest.fixture(scope="module") def la...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy_fastapi_mount/app.py
test/test_docker/test_reverse_proxy_fastapi_mount/app.py
import uvicorn from fastapi import FastAPI import gradio as gr demo = gr.Interface(lambda x: f"Hi {x}", "textbox", "textbox") app = FastAPI() gr.mount_gradio_app(app, demo, path="/mount") uvicorn.run(app, host="0.0.0.0", port=8000)
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy/test_reverse_proxy.py
test/test_docker/test_reverse_proxy/test_reverse_proxy.py
import os import random import re import sys import gradio_client import pytest import requests TEST_NAME = "reverse_proxy" folder = os.path.dirname(os.path.abspath(__file__)) pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="Skipped on Windows") @pytest.fixture(scope="module") def launch_services(...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy/app.py
test/test_docker/test_reverse_proxy/app.py
import gradio as gr demo = gr.Interface(lambda x: f"Hi {x}", "textbox", "textbox") demo.launch(server_name="0.0.0.0", server_port=8000)
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy_root_path/test_reverse_proxy_root_path.py
test/test_docker/test_reverse_proxy_root_path/test_reverse_proxy_root_path.py
import os import random import re import sys import gradio_client import pytest import requests TEST_NAME = "reverse_proxy_root_path" folder = os.path.dirname(os.path.abspath(__file__)) pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="Skipped on Windows") @pytest.fixture(scope="module") def launch...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/test/test_docker/test_reverse_proxy_root_path/app.py
test/test_docker/test_reverse_proxy_root_path/app.py
import gradio as gr demo = gr.Interface(lambda x: f"Hi {x}", "textbox", "textbox") demo.launch(server_name="0.0.0.0", server_port=8000, root_path="/gradio/demo")
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/block_function.py
gradio/block_function.py
from __future__ import annotations import inspect from collections.abc import Callable, Sequence from typing import TYPE_CHECKING, Literal from . import utils try: import spaces # type: ignore except Exception: spaces = None if TYPE_CHECKING: # Only import for type checking (is False at runtime). fro...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/brotli_middleware.py
gradio/brotli_middleware.py
"""AGSI Brotli middleware build on top of starlette. Code is based on GZipMiddleware shipped with starlette. """ import io import re from typing import NoReturn from brotli import MODE_FONT, MODE_GENERIC, MODE_TEXT, Compressor # type: ignore from starlette.datastructures import Headers, MutableHeaders from starlett...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/monitoring_dashboard.py
gradio/monitoring_dashboard.py
import random import time import pandas as pd import gradio as gr data = {"data": {}} with gr.Blocks() as demo: gr.Markdown("# Monitoring Dashboard") timer = gr.Timer(5) with gr.Row(): start = gr.DateTime("now - 24h", label="Start Time") end = gr.DateTime("now", label="End Time") ...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/blocks.py
gradio/blocks.py
from __future__ import annotations import copy import dataclasses import hashlib import inspect import json import os import random import re import secrets import string import sys import threading import time import warnings import weakref import webbrowser from collections import defaultdict from collections.abc im...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
true
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/flagging.py
gradio/flagging.py
from __future__ import annotations import csv import datetime import json import os import re import time from abc import ABC, abstractmethod from collections.abc import Sequence from multiprocessing import Lock from pathlib import Path from typing import TYPE_CHECKING, Any from gradio_client import utils as client_u...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/processing_utils.py
gradio/processing_utils.py
from __future__ import annotations import asyncio import base64 import hashlib import ipaddress import json import logging import mimetypes import os import shutil import subprocess import tempfile import warnings from collections.abc import Awaitable, Callable, Coroutine from functools import lru_cache, wraps from io...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
true
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/renderable.py
gradio/renderable.py
from __future__ import annotations from collections.abc import Callable, Sequence from typing import TYPE_CHECKING, Literal, Union, cast from gradio_client.documentation import document from gradio.blocks import Block from gradio.components import Component from gradio.context import Context, LocalContext from gradi...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/external_utils.py
gradio/external_utils.py
"""Utility function for gradio/external.py, designed for internal use.""" from __future__ import annotations import base64 import inspect import json import math import re import warnings import httpx import yaml from gradio_client.utils import encode_url_or_file_to_base64 from huggingface_hub import HfApi, ImageCla...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/chat_interface.py
gradio/chat_interface.py
""" This file defines a useful high-level abstraction to build Gradio chatbots: ChatInterface. """ from __future__ import annotations import builtins import copy import dataclasses import inspect import os import warnings from collections.abc import AsyncGenerator, Callable, Generator from functools import wraps from...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
true
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/ranged_response.py
gradio/ranged_response.py
# Taken from https://gist.github.com/kevinastone/a6a62db57577b3f24e8a6865ed311463 # Context: https://github.com/encode/starlette/pull/1090 from __future__ import annotations import os import re import stat from typing import NamedTuple from urllib.parse import quote import aiofiles from aiofiles.os import stat as aio...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/analytics.py
gradio/analytics.py
"""Functions related to analytics and telemetry.""" from __future__ import annotations import asyncio import json import os import threading import urllib.parse import warnings from typing import Any import httpx from huggingface_hub.utils._telemetry import _send_telemetry_in_thread from packaging.version import Ver...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/exceptions.py
gradio/exceptions.py
from __future__ import annotations from gradio_client.documentation import document from gradio_client.exceptions import AppError class DuplicateBlockError(ValueError): """Raised when a Blocks contains more than one Block with the same id""" pass class InvalidComponentError(ValueError): """Raised when...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false
gradio-app/gradio
https://github.com/gradio-app/gradio/blob/3b56b13268ddcaf74d4e85e5dbf5a616d7843995/gradio/image_utils.py
gradio/image_utils.py
from __future__ import annotations import base64 import warnings from io import BytesIO from pathlib import Path from typing import Literal, cast from urllib.parse import quote import httpx import numpy as np import PIL.Image from gradio_client.utils import get_mimetype, is_http_url_like from PIL import ImageOps fro...
python
Apache-2.0
3b56b13268ddcaf74d4e85e5dbf5a616d7843995
2026-01-04T14:40:26.993006Z
false