voc_bot / front_end.py
hiddenVariable's picture
Upload folder using huggingface_hub
486fa79 verified
raw
history blame
723 Bytes
import gradio as gr
from rag import mongo_rag_tool
from gradio.themes.base import Base
# Create an instance of GradIO
with gr.Blocks(theme=Base(), title="Market Research and VOC bot") as demo:
gr.Markdown(
"""
# VOC App using mined data
""")
textbox = gr.Textbox(label="Enter your Question:")
with gr.Row():
button = gr.Button("Submit", variant="primary")
with gr.Column():
output1 = gr.Textbox(lines=1, max_lines=10, label="Answer:")
output2 = gr.Textbox(lines=1, max_lines=10, label="Sources:")
# Call query_data function upon clicking the Submit button
button.click(mongo_rag_tool, textbox, outputs=[output1, output2])
demo.launch(share=True)