File size: 739 Bytes
2280bd6
8909fcd
2280bd6
 
3b27764
 
8909fcd
 
2280bd6
8909fcd
 
2280bd6
8909fcd
2280bd6
8909fcd
 
3b27764
8909fcd
 
3b27764
8909fcd
2280bd6
8909fcd
 
3b27764
 
 
 
8909fcd
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from fastapi import FastAPI
import requests

app = FastAPI()

@app.get("/")
def root():
    try:
        response = requests.get("http://beibeioo.top")
        return response.content
    except Exception as e:
        return {"error": str(e)}

@app.get("/api/{path:path}")
def api_proxy(path: str):
    try:
        response = requests.get(f"http://beibeioo.top/{path}")
        return response.content
    except Exception as e:
        return {"error": str(e)}

# 创建一个简单的 Gradio 界面
interface = gr.Interface(
    fn=lambda x: x,
    inputs=gr.Textbox(visible=False),
    outputs=gr.Textbox(visible=False),
    title="API Proxy"
)

# 挂载应用
app = gr.mount_gradio_app(app, interface, path="/ui")