File size: 981 Bytes
768e948
7d8456b
7ff86f9
768e948
239f9fe
 
 
 
 
7ff86f9
239f9fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768e948
239f9fe
 
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
import gradio as gr
from ui.tabs import loader_tab, chunker_tab
import spaces

# @spaces.GPU
# def greet(name):
#     return "Hello " + name + "!"

# demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
@spaces.GPU
def main():
    with gr.Blocks(title="RAG Pipeline Prototype") as demo:
        shared_docs_state = gr.State([])   # the hand-off point between phases

        with gr.Sidebar():
            gr.Markdown("## RAG Pipeline Prototype")
            doc_count_box = gr.Textbox(label="Documents loaded", value="0", interactive=False)

        with gr.Tabs():
            with gr.Tab("1. Web Loader"):
                loader_tab.build(shared_docs_state).render()
            with gr.Tab("2. Chunker (coming soon)"):
                chunker_tab.build(shared_docs_state).render()

        shared_docs_state.change(fn=lambda docs: str(len(docs)), inputs=shared_docs_state, outputs=doc_count_box)

        
    demo.launch() 

if __name__ == "__main__":
    main()