Help understanding link between FastAPI and Gradio
Hey Guys,I’ve written a small python app using FastAPI and I’m struggling to understand how I can put a simple Gradio app on top of it. I want to be able to have both options available to a user.Complete functionality via FastAPI for those who don’t want to use the gradio interface (ideally there will eventually be an ios app and other things that use simple REST APIGraphical interface for those who want something simple.I’ve tried reading over the examples in the gradio documentation but I just can’t make this make sense in my head.I don’t know if I should build out the FastAPI by itself, then create a front end that can utilize it using Gradio, or if I can build the whole thing in Gradio and somehow make it also serve as a REST API endpoint…An example of one of my functions is below. I’d greatly appreciate any assistance in trying to pull this all together.@app.post("/bookmarks/add")
async def add_bookmark_route(payload: Bookmark):
    url = str(payload.url)
    print(f"Received URL: {url}")
    results = await add_bookmark(url)
    if "URL Already Exists" in results:
        return {"message": "URL already exists"}
    

    return {"message": "Bookmark added successfully"}
2023-07-30T04:43:43Z
Hi@ChadDa3monthanks for asking here! We wrote documentation for this exact use case here:Sharing Your App