md-vasim's picture
first commit
e39ab22
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("# <center> Welcome to ExploreDoc Web App</center>")
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("<center> Developed by <a href='https://92-vasim.github.io' target='_blank'>Mohammed Vasim<a/> | AI Engineer & Computer Vision Engineer @ ZestIoT. </center>")
if __name__ == "__main__":
textbot.queue().launch(server_name="0.0.0.0")