|
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 = 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(model, [input], text_output) |