File size: 902 Bytes
ea5c59c
 
 
8d4620d
9ec3b13
ea5c59c
8d4620d
 
 
 
 
ea5c59c
8d4620d
ea5c59c
1ed0b9b
ea5c59c
 
 
 
 
8d4620d
df8e5ee
9ec3b13
df8e5ee
 
 
 
 
 
 
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
import pandas as pd
import numpy as np
import os
from grobidmonkey import reader

def save_uploaded_file(uploaded_file):
    file_path = os.path.join("uploads", uploaded_file.name)
    with open(file_path, "wb") as f:
        f.write(uploaded_file.getbuffer())
    return file_path  # Return the file path as a string

st.title('Paper2Slides')

st.subheader('Upload paper in pdf format')
uploaded_file = st.file_uploader("Choose a file")
if uploaded_file is not None:
    st.write(uploaded_file.name)
    bytes_data = uploaded_file.getvalue()
    st.write(len(bytes_data), "bytes")
    saved_file_path = save_uploaded_file(uploaded_file)

monkeyReader = reader.MonkeyReader('monkey')
outline = monkeyReader.readOutline(saved_file_path)

for pre, fill, node in outline:
    st.write("%s%s" % (pre, node.name))

# read paper content
essay = monkeyReader.readEssay(saved_file_path)