File size: 1,062 Bytes
2b94668 1bccaf9 |
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 |
import gradio as gr
from langchain.document_loaders import UnstructuredURLLoader
from langchain.text_splitter import CharacterTextSplitter
def scrap(urls):
loaders = UnstructuredURLLoader(urls=[urls])
data = loaders.load()
# Text Splitter
text_splitter = CharacterTextSplitter(separator='\n',
chunk_size=1000,
chunk_overlap=200)
docs = text_splitter.split_documents(data)
return docs
with gr.Blocks() as demo:
f=0
gr.Markdown('# <center>INTELLIGENT ANALYSIS OF DOCUMENTS DRIVEN QA CHATBOT</center>')
input=gr.Textbox(
label='Enter the website URL',
placeholder='https://kceai.com/'
)
text_button = gr.Button("Build the Bot!!!")
text_output = gr.Textbox(
label="Verify the status",
placeholder="Start Building the Bot to view the content")
text_button.click(scrap, [input], text_output)
demo.queue().launch(debug = True,
auth=("username", "password"),
) |