Spaces:
Runtime error
Runtime error
Download app.py from youngtsai/request_test: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/spaces/youngtsai/request_test/resolve/main/app.py
- Command line
-
hf download hf://spaces/youngtsai/request_test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/youngtsai/request_test/resolve/main/app.py
448 Bytes
| import gradio as gr | |
| def echo(text, request: gr.Request): | |
| if request: | |
| print("Request headers dictionary:", request.headers) | |
| print("IP address:", request.client.host) | |
| print("Query parameters:", dict(request.query_params)) | |
| return text | |
| with gr.Blocks() as demo: | |
| text_1 = gr.Textbox() | |
| text_2 = gr.Textbox() | |
| demo.load( | |
| echo, | |
| inputs=[text_1], | |
| outputs=[text_2] | |
| ) | |
| demo.launch() |