generated from mozilla-ai/Blueprint-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
import streamlit as st | ||
|
||
st.title("Blueprint Demo") | ||
from opennotebookllm.preprocessing.data_loaders import load_pdf | ||
from opennotebookllm.preprocessing.data_cleaners import clean_html, clean_pdf | ||
|
||
|
||
uploaded_file = st.file_uploader("Choose a file", type=["pdf", "html"]) | ||
|
||
if uploaded_file is not None: | ||
if uploaded_file.type == "text/html": | ||
raw_text = uploaded_file.getvalue().decode("utf-8") | ||
clean_text = clean_html(raw_text) | ||
elif uploaded_file.type == "application/pdf": | ||
raw_text = load_pdf(uploaded_file) | ||
clean_text = clean_pdf(raw_text) | ||
col1, col2 = st.columns(2) | ||
with col1: | ||
st.title("Raw Text") | ||
st.write(raw_text[:200]) | ||
with col2: | ||
st.title("Cleaned Text") | ||
st.write(clean_text[:200]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters