mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-17 11:29:58 +08:00
* implement missing methods handle nested dict test for get 'user-agent' extra example for gr.Requests * missing notebook example * add missing attributes, keys, values, items * update changelog * fix changelog
16 lines
328 B
Python
16 lines
328 B
Python
import gradio as gr
|
|
|
|
|
|
def predict(text, request: gr.Request):
|
|
headers = request.headers
|
|
host = request.client.host
|
|
user_agent = request.headers["user-agent"]
|
|
return {
|
|
"ip": host,
|
|
"user_agent": user_agent,
|
|
"headers": headers,
|
|
}
|
|
|
|
|
|
gr.Interface(predict, "text", "json").queue().launch()
|