os1187 commited on
Commit
84fb8de
1 Parent(s): 727ee54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -35
app.py CHANGED
@@ -79,42 +79,8 @@ with open('data/'+contracts_files[idx]) as f:
79
  #user_upload = st.sidebar.file_uploader('Please upload your own', type=['txt'],
80
  # accept_multiple_files=False)
81
 
82
- ''''
83
- # process upload
84
- if user_upload is not None:
85
- print(user_upload.name, user_upload.type)
86
- extension = user_upload.name.split('.')[-1].lower()
87
- if extension == 'txt':
88
- print('text file uploaded')
89
- # To convert to a string based IO:
90
- stringio = StringIO(user_upload.getvalue().decode("utf-8"))
91
-
92
- # To read file as string:
93
- contract_data = stringio.read()
94
-
95
- # elif extension == 'pdf':
96
- # import PyPDF4
97
- # try:
98
- # # Extracting Text from PDFs
99
- # pdfReader = PyPDF4.PdfFileReader(user_upload)
100
- # print(pdfReader.numPages)
101
- # contract_data = ''
102
- # for i in range(0, pdfReader.numPages):
103
- #
104
- # print(i)
105
- # pageobj = pdfReader.getPage(i)
106
- # contract_data = contract_data + pageobj.extractText()
107
- # except:
108
- # st.warning('Unable to read PDF, please try another file')
109
- #
110
- # elif extension == 'docx':
111
- # import docx2txt
112
- #
113
- # contract_data = docx2txt.process(user_upload)
114
 
115
- else:
116
- st.warning('Unknown uploaded file type, please try again')
117
- ''''
118
  results_drop = ['1', '2', '3']
119
  number_results = st.sidebar.selectbox('Select number of results', results_drop)
120
 
 
79
  #user_upload = st.sidebar.file_uploader('Please upload your own', type=['txt'],
80
  # accept_multiple_files=False)
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+
 
 
84
  results_drop = ['1', '2', '3']
85
  number_results = st.sidebar.selectbox('Select number of results', results_drop)
86