Spaces:
Runtime error
Runtime error
no message
Browse files
app.py
CHANGED
@@ -3,22 +3,14 @@ import json
|
|
3 |
|
4 |
DEBUG_MODE = False
|
5 |
|
|
|
6 |
def echo(text, request: gr.Request):
|
7 |
output_text = {"report1": "SUCCESS"} # Initialize as a dictionary
|
8 |
output_text["report2"] = "You inserted the text:"
|
9 |
output_text["report3"] = text
|
10 |
if request:
|
11 |
-
if DEBUG_MODE:
|
12 |
-
print("Request object:", request)
|
13 |
-
print("Request headers dictionary:", request.headers)
|
14 |
-
print("IP address:", request.client.host)
|
15 |
-
print("Query parameters:", dict(request.query_params))
|
16 |
# Convert headers to a dictionary and include them in the output_text
|
17 |
output_text["headers"] = dict(request.headers.items())
|
18 |
-
output_text["host"] = request.client.host
|
19 |
-
output_text["query_params"] = dict(request.query_params)
|
20 |
-
if DEBUG_MODE:
|
21 |
-
print("Query parameters:", dict(request.query_params))
|
22 |
|
23 |
# Convert the output_text dictionary to a JSON-formatted string
|
24 |
output_text_json = json.dumps(output_text)
|
|
|
3 |
|
4 |
DEBUG_MODE = False
|
5 |
|
6 |
+
|
7 |
def echo(text, request: gr.Request):
|
8 |
output_text = {"report1": "SUCCESS"} # Initialize as a dictionary
|
9 |
output_text["report2"] = "You inserted the text:"
|
10 |
output_text["report3"] = text
|
11 |
if request:
|
|
|
|
|
|
|
|
|
|
|
12 |
# Convert headers to a dictionary and include them in the output_text
|
13 |
output_text["headers"] = dict(request.headers.items())
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Convert the output_text dictionary to a JSON-formatted string
|
16 |
output_text_json = json.dumps(output_text)
|