import os
from dotenv import load_dotenv
import gradio as gr
from src.utils import (
process_files, answer_query
)
load_dotenv()
gr.close_all()
title = ""
description = f"Chat with PDF/TXT/DOC"
chatbot = gr.Chatbot(label="ExploreText")
with gr.Blocks(
title="ExploreText",
) as textbot:
gr.Markdown("#
Welcome to ExploreDoc Web App")
with gr.Accordion("Upload a file here", open=False):
file_output = gr.File()
upload_button = gr.UploadButton("Click to Upload a File", file_types=["txt","doc","pdf"])
upload_button.upload(process_files, upload_button, file_output)
# with gr.Row("Chat with Text"):
gr.ChatInterface(fn=answer_query, chatbot=chatbot, submit_btn="Ask", undo_btn=None, retry_btn=None, clear_btn=None)
gr.Markdown(" Developed by Mohammed Vasim | AI Engineer & Computer Vision Engineer @ ZestIoT. ")
if __name__ == "__main__":
textbot.queue().launch(server_name="0.0.0.0")