Spaces:
Sleeping
Sleeping
import streamlit as st | |
import pymupdf | |
st.write("## Convert your documents into PDF") | |
file = st.file_uploader("Upload your Document Here to Query") | |
if file is not None: | |
bytes_data = file.getvalue() | |
input_fp = "data/uploaded_file" | |
output_fp = "output/finished_file" | |
with open(input_fp, "wb") as fp: | |
fp.write(bytes_data) | |
with pymupdf.open(input_fp) as doc: | |
texts = [page.get_text().encode("utf-8") for page in doc] | |
with open(output_fp, "wb") as out: | |
[out.write(text) for text in texts] | |