Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -42,10 +42,19 @@ 
     | 
|
| 42 | 
         | 
| 43 | 
         
             
            import streamlit as st
         
     | 
| 44 | 
         
             
            import urllib # the lib that handles the url stuff
         
     | 
| 
         | 
|
| 
         | 
|
| 45 | 
         | 
| 46 | 
         
             
            target_url = 'https://huggingface.co/datasets/Seetha/Visualization/raw/main/AFLAC_Wyatt_notag.pdf'
         
     | 
| 47 | 
         
             
            if st.button('PDF1'):
         
     | 
| 48 | 
         
             
                data = urllib.request.urlopen(target_url)
         
     | 
| 49 | 
         
            -
                 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 50 | 
         
             
            else:
         
     | 
| 51 | 
         
             
                st.write('Goodbye')
         
     | 
| 
         | 
|
| 42 | 
         | 
| 43 | 
         
             
            import streamlit as st
         
     | 
| 44 | 
         
             
            import urllib # the lib that handles the url stuff
         
     | 
| 45 | 
         
            +
            from PyPDF2 import PdfReader
         
     | 
| 46 | 
         
            +
            text_list = []
         
     | 
| 47 | 
         | 
| 48 | 
         
             
            target_url = 'https://huggingface.co/datasets/Seetha/Visualization/raw/main/AFLAC_Wyatt_notag.pdf'
         
     | 
| 49 | 
         
             
            if st.button('PDF1'):
         
     | 
| 50 | 
         
             
                data = urllib.request.urlopen(target_url)
         
     | 
| 51 | 
         
            +
                if data is not None:
         
     | 
| 52 | 
         
            +
                    reader = PdfReader(uploaded_file)
         
     | 
| 53 | 
         
            +
                    for page in reader.pages:
         
     | 
| 54 | 
         
            +
                        text = page.extract_text()
         
     | 
| 55 | 
         
            +
                          text_list.append(text)
         
     | 
| 56 | 
         
            +
                else:
         
     | 
| 57 | 
         
            +
                     st.error("Please upload your own PDF to be analyzed")
         
     | 
| 58 | 
         
            +
                     st.stop()
         
     | 
| 59 | 
         
             
            else:
         
     | 
| 60 | 
         
             
                st.write('Goodbye')
         
     |