-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (25 loc) · 859 Bytes
/
main.py
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
import streamlit as st
from parse import (
scrape,
extract_body_content,
clean_body_content,
split_content,
parse,
)
# Scrape the website
description = st.text_area("Describe what you want to know")
description = description.replace(" ", "+")
content = scrape(f"https://www.google.com/search?q={description}")
body_content = extract_body_content(content)
cleaned_content = clean_body_content(body_content)
# Store the content
st.session_state.dom_content = cleaned_content
# Ask Questions
if "dom_content" in st.session_state:
if st.button("Let's go"):
if description:
st.write("Analyzing the content...")
# Provide the content with Ollama
chunks = split_content(st.session_state.dom_content)
parsed_result = parse(chunks, description)
st.write(parsed_result)