File size: 830 Bytes
9d2647f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a216fe
9d2647f
 
 
 
 
 
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
import gradio as gr


class AppWrapper:
    def __init__(self):
        self._interfaces = []  # List of tuples: (interface_obj, tab_name)

    def register_interface(self, interface_obj, tab_name):
        """
        Register an interface object with a corresponding tab name.
        """
        self._interfaces.append((interface_obj, tab_name))

    def build_app(self):
        """
        Build the Gradio TabbedInterface from registered interfaces.
        """
        interface_list = [iface.interface for iface, _ in self._interfaces]
        tab_names = [tab for _, tab in self._interfaces]
        self.app = gr.TabbedInterface(
            title="Web Search MCP",
            interface_list=interface_list,
            tab_names=tab_names,
        )

    def launch(self, **kwargs):
        self.app.launch(**kwargs)