russkiyximik commited on
Commit
18700aa
·
1 Parent(s): d2d2822

chagned tmpfile to streamlit internal option

Browse files
Files changed (1) hide show
  1. mycoder/app.py +7 -5
mycoder/app.py CHANGED
@@ -7,12 +7,14 @@ st.write("This is a demo application for the MyCoder crew.")
7
 
8
  uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"])
9
  if uploaded_file is not None:
10
- uploaded_path = os.path.join("data", uploaded_file.name)
11
- with open(uploaded_path, "wb") as f:
12
- f.write(uploaded_file.getbuffer())
13
- st.success(f"File uploaded and saved as {uploaded_path}")
 
 
14
 
15
- st.write("Make sure to specify the correct file name in your query, e.g. 'data/Iris.csv'.")
16
  question = st.text_input("Enter your query:")
17
 
18
  if st.button("Run MyCoder Crew"):
 
7
 
8
  uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"])
9
  if uploaded_file is not None:
10
+ import tempfile
11
+ with tempfile.NamedTemporaryFile(mode='wb', delete=True, suffix=".csv") as temp_file:
12
+ temp_file.write(uploaded_file.getbuffer())
13
+ temp_file_path = temp_file.name
14
+
15
+ st.success(f"File uploaded and saved as {temp_file_path}")
16
 
17
+ st.write("Make sure to specify the correct file name in your query, e.g. 'Iris.csv'.")
18
  question = st.text_input("Enter your query:")
19
 
20
  if st.button("Run MyCoder Crew"):