File size: 556 Bytes
cabaed4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_main():
    return {"message": "Fair Dinkum Book Hub is live!"}

# Define your Gradio/MCP tools
with gr.Blocks() as demo:
    gr.Markdown("# Fair Dinkum MCP Tools")
    
    @gr.mcp.tool(name="process_book")
    def process_book(title: str):
        """Processes a book title for the hub."""
        return f"Book '{title}' has been successfully processed into the catalog."

# Mount Gradio/MCP to the FastAPI app
app = gr.mount_gradio_app(app, demo, path="/gradio")