Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,15 +64,31 @@ class Model:
|
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
-
|
| 68 |
-
uploaded_file = st.file_uploader("Choose a file")
|
| 69 |
mode = st.selectbox('What kind of summary do you want?',
|
| 70 |
('Simple', 'Analytical'))
|
| 71 |
st.write('You selected: ' + mode + ' summary.')
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
|
| 78 |
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
|
|
|
|
|
|
|
| 67 |
mode = st.selectbox('What kind of summary do you want?',
|
| 68 |
('Simple', 'Analytical'))
|
| 69 |
st.write('You selected: ' + mode + ' summary.')
|
| 70 |
+
title = st.text_input('Title of the .csv file', 'State minimum wage rates in the United States as of January 1 , 2020 , by state ( in U.S. dollars )')
|
| 71 |
+
st.write('Title of the file is: ' + title)
|
| 72 |
+
uploaded_file = st.file_uploader("Upload only .csv file")
|
| 73 |
+
if uploaded_file is not None and mode is not None and title is not None:
|
| 74 |
+
st.write('Preprocessing file...')
|
| 75 |
+
p = preProcess(uploaded_file, title)
|
| 76 |
+
contents = p.read_data()
|
| 77 |
+
st.bar_chart(contents)
|
| 78 |
+
st.write(contents)
|
| 79 |
+
check = p.check_columns(contents)
|
| 80 |
+
if check:
|
| 81 |
+
title_data = p.combine_title_data(contents)
|
| 82 |
+
st.write('Linearized input format of the data file: ' + title_data)
|
| 83 |
+
|
| 84 |
+
st.write('Loading model...')
|
| 85 |
+
model = Model(title_data, mode)
|
| 86 |
+
st.write('Model loading done!\nGenerating Summary...')
|
| 87 |
+
summary = model.generate()
|
| 88 |
+
st.write('Generated Summary: ')
|
| 89 |
+
st.text(summary)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
|
| 93 |
|
| 94 |
|