Spaces:
Runtime error
Runtime error
Commit
·
ce1c969
1
Parent(s):
d480317
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,21 @@ import plotly.express as px
|
|
| 5 |
|
| 6 |
uploaded_file = st.file_uploader("Choose a CSV file", accept_multiple_files=False)
|
| 7 |
series = st.text_input("Write the name of the variable you want to forecast")
|
| 8 |
-
bytes_data = uploaded_file.read()
|
| 9 |
-
st.write("filename:", uploaded_file.name)
|
| 10 |
-
st.write(bytes_data)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
uploaded_file = st.file_uploader("Choose a CSV file", accept_multiple_files=False)
|
| 7 |
series = st.text_input("Write the name of the variable you want to forecast")
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
if uploaded_file is not None:
|
| 10 |
+
# To read file as bytes:
|
| 11 |
+
bytes_data = uploaded_file.getvalue()
|
| 12 |
+
st.write(bytes_data)
|
| 13 |
+
|
| 14 |
+
# To convert to a string based IO:
|
| 15 |
+
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
| 16 |
+
st.write(stringio)
|
| 17 |
+
|
| 18 |
+
# To read file as string:
|
| 19 |
+
string_data = stringio.read()
|
| 20 |
+
st.write(string_data)
|
| 21 |
+
|
| 22 |
+
# Can be used wherever a "file-like" object is accepted:
|
| 23 |
+
dataframe = pd.read_csv(uploaded_file)
|
| 24 |
+
st.write(dataframe)
|
| 25 |
+
st.dataframe(dataframe)
|