File size: 1,724 Bytes
e90e7ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9650f42
e90e7ba
 
 
d2082a1
e90e7ba
e98811a
e90e7ba
 
e98811a
e90e7ba
 
f648e82
e90e7ba
f648e82
e90e7ba
 
f648e82
e90e7ba
 
f648e82
e90e7ba
 
f648e82
e90e7ba
 
f648e82
e90e7ba
68d264c
6492be6
 
e98811a
1e1c641
5853ee9
cee40ff
6492be6
 
 
 
 
 
 
 
e90e7ba
 
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
# import urllib.request
# import streamlit as st
# import os
# from datasets import load_from_disk
# import requests
# with urllib.request.urlopen('https://huggingface.co/datasets/Seetha/Visualization') as response:
#     data = response.read()

# with open('./level2.json','r+') as fi:
#     data = fi.read()
#     st.write('before change', data)
#     fi.seek(0)
#     fi.write('Hello world!')
#     fi.truncate()
#     st.write(os.path.abspath("./level2.json"))

# with open('./level2.json','w') as dat:
#     dat.write('hello hello')
#     #st.write(data_after)

# # bin_file = open('./level2.json', 'rb')

# # # Execute the request
# # response = requests.post('https://huggingface.co/datasets/Seetha/Visualization', files={'file': bin_file})

# # # Close the file
# # bin_file.close()

# from datasets import load_dataset

# # Load the dataset
# dataset = load_dataset("Seetha/Visualization")

# # Make changes to the dataset
# # ...

# # Save the changed dataset to a file
# dataset.save_to_disk('./level.json')

# # In your Streamlit app, load the dataset from the file
# dataset = load_dataset('json', data_files='./level.json')

import streamlit as st
import urllib # the lib that handles the url stuff
from PyPDF2 import PdfReader
text_list = []

target_url = 'https://huggingface.co/datasets/Seetha/Visualization/raw/main/AFLAC_Wyatt_notag.pdf'
if st.button('PDF1'):
    data = urllib.request.urlopen(target_url)
    if data is not None:
        reader = PdfReader(uploaded_file)
        for page in reader.pages:
            text = page.extract_text()
              text_list.append(text)
    else:
         st.error("Please upload your own PDF to be analyzed")
         st.stop()
else:
    st.write('Goodbye')