Update app.py
Browse files
app.py
CHANGED
@@ -42,9 +42,9 @@ def test_proxy(url, method="GET", payload=""):
|
|
42 |
headers = {"URL": url}
|
43 |
try:
|
44 |
if method == "GET":
|
45 |
-
response = requests.get("http://localhost:
|
46 |
else:
|
47 |
-
response = requests.request(method, "http://localhost:
|
48 |
|
49 |
return f"Status: {response.status_code}\nResponse: {response.text}"
|
50 |
except Exception as e:
|
@@ -63,16 +63,11 @@ gradio_interface = gr.Interface(
|
|
63 |
)
|
64 |
|
65 |
def run_flask():
|
66 |
-
flask_app.run(host='0.0.0.0', port=
|
67 |
|
68 |
-
def run_gradio():
|
69 |
-
gradio_interface.launch(server_name='0.0.0.0', server_port=7860)
|
70 |
|
71 |
if __name__ == '__main__':
|
72 |
# Запускаем Flask в отдельном потоке
|
73 |
flask_thread = threading.Thread(target=run_flask)
|
74 |
flask_thread.daemon = True
|
75 |
-
flask_thread.start()
|
76 |
-
|
77 |
-
# Запускаем Gradio в основном потоке
|
78 |
-
run_gradio()
|
|
|
42 |
headers = {"URL": url}
|
43 |
try:
|
44 |
if method == "GET":
|
45 |
+
response = requests.get("http://localhost:7860", headers=headers)
|
46 |
else:
|
47 |
+
response = requests.request(method, "http://localhost:7860", headers=headers, data=payload)
|
48 |
|
49 |
return f"Status: {response.status_code}\nResponse: {response.text}"
|
50 |
except Exception as e:
|
|
|
63 |
)
|
64 |
|
65 |
def run_flask():
|
66 |
+
flask_app.run(host='0.0.0.0', port=7860)
|
67 |
|
|
|
|
|
68 |
|
69 |
if __name__ == '__main__':
|
70 |
# Запускаем Flask в отдельном потоке
|
71 |
flask_thread = threading.Thread(target=run_flask)
|
72 |
flask_thread.daemon = True
|
73 |
+
flask_thread.start()
|
|
|
|
|
|