Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from langchain.document_loaders import UnstructuredURLLoader
|
3 |
+
from langchain.text_splitter import CharacterTextSplitter
|
4 |
+
|
5 |
+
def scrap(urls):
|
6 |
+
loaders = UnstructuredURLLoader(urls=[urls])
|
7 |
+
data = loaders.load()
|
8 |
+
|
9 |
+
# Text Splitter
|
10 |
+
text_splitter = CharacterTextSplitter(separator='\n',
|
11 |
+
chunk_size=1000,
|
12 |
+
chunk_overlap=200)
|
13 |
+
|
14 |
+
|
15 |
+
docs = text_splitter.split_documents(data)
|
16 |
+
return docs
|
17 |
+
|
18 |
+
with gr.Blocks() as demo:
|
19 |
+
f=0
|
20 |
+
gr.Markdown('# <center>INTELLIGENT ANALYSIS OF DOCUMENTS DRIVEN QA CHATBOT</center>')
|
21 |
+
input=gr.Textbox(
|
22 |
+
label='Enter the website URL',
|
23 |
+
placeholder='https://kceai.com/'
|
24 |
+
)
|
25 |
+
text_button = gr.Button("Build the Bot!!!")
|
26 |
+
text_output = gr.Textbox(
|
27 |
+
label="Verify the status",
|
28 |
+
placeholder="Start Building the Bot to view the content")
|
29 |
+
text_button.click(model, [input], text_output)
|