Spaces:
Sleeping
Sleeping
done, to test
Browse files
app.py
CHANGED
|
@@ -1,11 +1,16 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
def echo(text, request: gr.Request):
|
|
|
|
| 4 |
if request:
|
| 5 |
print("Request headers dictionary:", request.headers)
|
|
|
|
| 6 |
print("IP address:", request.client.host)
|
|
|
|
| 7 |
print("Query parameters:", dict(request.query_params))
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
io = gr.Interface(echo, "textbox", "textbox").launch(share=True)
|
| 11 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
|
| 4 |
def echo(text, request: gr.Request):
|
| 5 |
+
output_text = json.dumps({"text": text})
|
| 6 |
if request:
|
| 7 |
print("Request headers dictionary:", request.headers)
|
| 8 |
+
output_text = json.dumps({"headers": dict(request.headers)})
|
| 9 |
print("IP address:", request.client.host)
|
| 10 |
+
output_text = json.dumps({"headers": dict(request.headers)})
|
| 11 |
print("Query parameters:", dict(request.query_params))
|
| 12 |
+
output_text = json.dumps({"query_params": dict(request.query_params)})
|
| 13 |
+
return output_text
|
| 14 |
|
| 15 |
io = gr.Interface(echo, "textbox", "textbox").launch(share=True)
|
| 16 |
|