File size: 1,064 Bytes
e39ab22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
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")