Spaces:
Running
Running
File size: 3,942 Bytes
856bf31 b7fc263 856bf31 8409da9 856bf31 8409da9 d25211f 1eaf48d 856bf31 b7fc263 856bf31 cd67781 b7fc263 856bf31 cd67781 856bf31 cd67781 856bf31 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
import streamlit as st
from model import AllModels
from html_pdf import Pdf
from pdf_process import PdfExtract
from PIL import Image
model = AllModels()
roadmap_generator = Pdf()
st.title('NoteFusion')
st.markdown("""
<style>
.justified-text {
text-align: justify;
}
</style>
""", unsafe_allow_html=True)
# Sidebar Section
st.sidebar.title("About")
st.sidebar.caption("""
<div class="justified-text">
NoteFusion is an AI-powered educational assistant helps students by providing summarizing textbook content, and generating personalized study plans roadmap with Pdf and converts image to Notes and also creating own personalized book. built with Streamlit.
</div>
""", unsafe_allow_html=True)
for _ in range(3):
st.sidebar.write("")
menu = ["Image To Notes", "Summarize Textbook", "Generate Roadmap PDF","Generate own book"]
choice = st.sidebar.selectbox("Choose an option", menu)
for _ in range(8):
st.sidebar.write("")
st.sidebar.subheader("Build By:")
st.sidebar.write("[Suriya 🤍](https://github.com/theSuriya)")
st.sidebar.write("contact: [Email](mailto:[email protected])")
if choice == 'Generate Roadmap PDF':
st.subheader('Generate Roadmap PDF')
subjects = st.text_input("Enter the subjects you need help with (comma-separated)")
button = st.button("Generate RoadMap")
if subjects and button:
with st.spinner('creating...'):
response = model.road_map_model(subjects)
print(response)
response = response.replace("```html", "")
response = response.replace("```", "")
pdf_bytes = roadmap_generator.pdf_creator(response)
st.success("PDF generated successfully!")
st.download_button("Download PDF", data=pdf_bytes, file_name="output.pdf", mime="application/pdf")
elif choice == "Summarize Textbook":
st.subheader("Summarize Textbook")
uploaded_file = st.file_uploader("Upload a textbook pdf", type=["pdf",'png','jpg','jpeg'])
if uploaded_file:
button = st.button("Generate Summary")
type = uploaded_file.name.split('.')[-1]
if type!='pdf':
st.image(uploaded_file,caption='uploaded image')
else:
pdf_text = PdfExtract(uploaded_file)
if uploaded_file and button:
with st.spinner('creating...'):
if type == 'pdf':
response = model.summary_model(input_doc = pdf_text.extracted_text)
st.write(response)
else:
img = Image.open(uploaded_file)
response = model.summary_model(image=img)
st.write(response)
elif choice == "Generate own book":
st.subheader("Create your own book")
st.caption('write your book name our AI will create book for you')
book_name = st.text_input("textbook Name")
button = st.button("Generate Book")
if book_name and button:
with st.spinner('creating...'):
response = model.book_creator(book_name)
response = response.replace("```html", "")
response = response.replace("```", "")
pdf_bytes = roadmap_generator.pdf_creator(response)
st.success("Own Book generated successfully!")
st.download_button("Download Book", data=pdf_bytes, file_name="output.pdf", mime="application/pdf")
elif choice == "Image To Notes":
st.subheader("Image To Notes")
uploaded_file = st.file_uploader("Upload a image or screenshot", type=['png','jpg','jpeg'])
if uploaded_file:
st.image(uploaded_file,caption='uploaded image')
button = st.button("Generate Notes")
if uploaded_file and button:
with st.spinner('creating...'):
img = Image.open(uploaded_file)
response = model.note_model(img)
st.write(response)
|