Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,8 +65,23 @@ class Model:
|
|
| 65 |
|
| 66 |
|
| 67 |
uploaded_file = st.file_uploader("Choose a file")
|
| 68 |
-
if uploaded_file:
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
|
| 72 |
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
uploaded_file = st.file_uploader("Choose a file")
|
| 68 |
+
if uploaded_file is not None:
|
| 69 |
+
# To read file as bytes:
|
| 70 |
+
bytes_data = uploaded_file.getvalue()
|
| 71 |
+
st.write(bytes_data)
|
| 72 |
+
|
| 73 |
+
# To convert to a string based IO:
|
| 74 |
+
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
| 75 |
+
st.write(stringio)
|
| 76 |
+
|
| 77 |
+
# To read file as string:
|
| 78 |
+
string_data = stringio.read()
|
| 79 |
+
st.write(string_data)
|
| 80 |
+
|
| 81 |
+
# Can be used wherever a "file-like" object is accepted:
|
| 82 |
+
dataframe = pd.read_csv(uploaded_file)
|
| 83 |
+
st.write(dataframe)
|
| 84 |
+
|
| 85 |
|
| 86 |
|
| 87 |
|