chore: import upstream snapshot with attribution
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:17:32 +08:00
commit adf0d17497
3085 changed files with 456962 additions and 0 deletions
@@ -0,0 +1,10 @@
FROM python:3.10-slim
WORKDIR /app
COPY *.whl ./
RUN pip install --no-cache-dir *.whl
COPY app.py .
CMD ["python", "app.py"]
@@ -0,0 +1,5 @@
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")
@@ -0,0 +1,28 @@
version: "3.8"
services:
app:
build: .
container_name: ${COMPOSE_PROJECT_NAME}_app
networks:
- app_network
hostname: app
ports:
- "0:8000"
nginx:
image: nginx:latest
container_name: ${COMPOSE_PROJECT_NAME}_nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- /dev/null:/etc/nginx/conf.d/default.conf:ro
ports:
- "0:80"
depends_on:
- app
networks:
- app_network
networks:
app_network:
driver: bridge
@@ -0,0 +1,25 @@
events {
worker_connections 1024;
}
http {
server {
listen 80;
location = /gradio/demo {
return 301 $scheme://$http_host$request_uri/;
}
location /gradio/demo/ {
proxy_pass http://app:8000/;
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
@@ -0,0 +1,76 @@
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_services(launch_services_fn):
yield from launch_services_fn(TEST_NAME, folder, "/gradio/demo", "/gradio/demo")
@pytest.mark.serial
def test_endpoint_status(launch_services):
for endpoint in launch_services:
response = requests.get(endpoint)
assert response.status_code == 200
response = requests.get(f"{endpoint}/config")
assert response.status_code == 200
config = response.json()
response = requests.get(f"{config['root']}/theme.css")
assert response.status_code == 200
response = requests.get(f"{endpoint}/fail")
assert response.status_code == 404
@pytest.mark.serial
def test_api_response(launch_services):
for endpoint in launch_services:
client = gradio_client.Client(endpoint)
result = client.predict("John")
assert result == "Hi John"
@pytest.mark.serial
def test_load_assets(launch_services):
for endpoint in launch_services:
asset_regex = '"\\.\\/([A-Za-z0-9-_\\/.]+\\.(?:js|css))"'
response = requests.get(endpoint)
assert response.status_code == 200
html = response.text
main_assets = re.findall(asset_regex, html)
js_asset_found = False
css_asset_found = False
for main_asset in main_assets:
asset_url = f"{endpoint}/{main_asset}"
asset_response = requests.get(asset_url)
assert asset_response.status_code == 200
assert len(asset_response.text) > 0
if main_asset.endswith(".js"):
js_asset_found = True
first_line = asset_response.text.split(";")[0]
sub_assets = re.findall(asset_regex, first_line)
assert len(sub_assets) > 1
random.shuffle(sub_assets)
for sub_asset in sub_assets[:5]:
sub_asset_path = asset_url[: asset_url.rfind("/")]
sub_asset_url = f"{sub_asset_path}/{sub_asset}"
print("URL:", sub_asset_url)
sub_asset_response = requests.get(sub_asset_url)
assert sub_asset_response.status_code == 200
assert len(sub_asset_response.text) > 0
elif main_asset.endswith(".css"):
css_asset_found = True
assert js_asset_found
assert css_asset_found