Update main.py
Browse files
main.py
CHANGED
|
@@ -51,19 +51,3 @@ def api_request(url: str, request_type: str, json_data: str = None):
|
|
| 51 |
except Exception as e:
|
| 52 |
return str(e)
|
| 53 |
|
| 54 |
-
# 创建Gradio界面
|
| 55 |
-
iface = gr.Interface(
|
| 56 |
-
fn=api_request,
|
| 57 |
-
inputs=[
|
| 58 |
-
gr.Textbox(label="URL", placeholder="Enter the URL to send request to"),
|
| 59 |
-
gr.Radio(["GET", "POST"], label="Request Type"),
|
| 60 |
-
gr.Textbox(label="POST JSON Data (only for POST)", placeholder="Enter JSON data, e.g. {'content': 'Hello'}", visible=False)
|
| 61 |
-
],
|
| 62 |
-
outputs="json",
|
| 63 |
-
live=True
|
| 64 |
-
)
|
| 65 |
-
|
| 66 |
-
# 启动FastAPI应用
|
| 67 |
-
@app.on_event("startup")
|
| 68 |
-
async def startup():
|
| 69 |
-
iface.queue().launch(share=True) # 启动Gradio界面,并共享链接
|
|
|
|
| 51 |
except Exception as e:
|
| 52 |
return str(e)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|