Spaces:
Sleeping
Sleeping
import gradio as gr | |
from .utils import rag_generate | |
# --------------------------------------------------------------------- | |
# Gradio Interface with MCP support | |
# --------------------------------------------------------------------- | |
ui = gr.Interface( | |
fn=rag_generate, | |
inputs=[ | |
gr.Textbox( | |
label="Query", | |
lines=2, | |
placeholder="What would you like to know?", | |
info="Enter your question here" | |
), | |
gr.Textbox( | |
label="Context", | |
lines=8, | |
placeholder="Paste relevant documents or context here...", | |
info="Provide the context/documents to use for answering" | |
), | |
], | |
outputs=gr.Textbox( | |
label="Generated Answer", | |
lines=6, | |
show_copy_button=True | |
), | |
title="RAG Generation Service", | |
description="Ask questions based on provided context. Intended for use in RAG pipelines (i.e. context supplied by semantic retriever service) as an MCP server.", | |
) | |
# Launch with MCP server enabled | |
if __name__ == "__main__": | |
ui.launch( | |
server_name="0.0.0.0", | |
server_port=7860, | |
mcp_server=True, | |
show_error=True | |
) | |