Anuj
added the main fuction
7d8456b
Raw
History Blame Contribute Delete
981 Bytes
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()