File tree Expand file tree Collapse file tree 4 files changed +52
-38
lines changed
Expand file tree Collapse file tree 4 files changed +52
-38
lines changed Original file line number Diff line number Diff line change 44
55
66PAGES = {
7- "Annotations Upload" : upload .annotations ,
8- "Requirements Upload" : upload .requirements ,
7+ "Annotations Upload" : upload .annotations . show ,
8+ "Requirements Upload" : upload .requirements . show ,
99}
1010
1111
Original file line number Diff line number Diff line change 1+ from pages .upload import annotations
2+ from pages .upload import requirements
Original file line number Diff line number Diff line change 1+ import io
2+
13import streamlit as st
24import csv
35
4- st .title ("Upload *.trace.csv file" )
56
6- uploaded_file = st .file_uploader ("Choose a *.trace.csv file" , type = "csv" )
7+ def show ():
8+ st .title ("Upload *.trace.csv file" )
9+
10+ uploaded_files = st .file_uploader ("Choose a *.trace.csv file" , type = "csv" , accept_multiple_files = True )
711
8- if uploaded_file is not None :
9- try :
10- # Read the file as a string
11- with open (uploaded_file , "r" ) as trace_file :
12- reader = csv .reader (trace_file )
12+ for uploaded_file in uploaded_files :
13+ try :
14+ # Read the file as a string
15+ stringio = io . StringIO (uploaded_file . getvalue (). decode ( "utf-8" ))
16+ reader = csv .reader (stringio )
1317 rows = list (reader )
1418 # run indexing
1519 # run trace
1620
17- if rows :
18- st .success ("CSV file uploaded and parsed successfully!" )
19- st .subheader ("Extracted Rows:" )
20- # Display as a table
21- st .table (rows )
22- else :
23- st .warning ("The uploaded CSV file is empty." )
24- except Exception as e :
25- st .error (f"Failed to parse CSV file: { e } " )
26- else :
27- st .info ("Please upload a *.trace.csv file to extract rows." )
21+ if rows :
22+ st .success ("CSV file uploaded and parsed successfully!" )
23+ st .subheader ("Extracted Rows:" )
24+ # Display as a table
25+ st .table (rows )
26+ else :
27+ st .warning ("The uploaded CSV file is empty." )
28+ except Exception as e :
29+ st .error (f"Failed to parse CSV file: { e } " )
30+
31+ if not uploaded_files :
32+ st .info ("Please upload a *.trace.csv file to extract rows." )
33+ return False
Original file line number Diff line number Diff line change 1+ import io
2+
13import streamlit as st
24import csv
35
4- st .title ("Upload a file with requirements." )
56
6- uploaded_file = st .file_uploader ("Choose a file with requirements" , type = "csv" )
7+ def show ():
8+ st .title ("Upload a file with requirements." )
9+
10+ uploaded_files = st .file_uploader ("Choose a file with requirements" , type = "csv" )
711
8- if uploaded_file is not None :
9- try :
10- # Read the file as a string
11- with open (uploaded_file , "r" ) as trace_file :
12- reader = csv .reader (trace_file )
12+ for uploaded_file in uploaded_files :
13+ try :
14+
15+ stringio = io . StringIO (uploaded_file . getvalue (). decode ( "utf-8" ))
16+ reader = csv .reader (stringio )
1317 rows = list (reader )
1418 # run indexing
1519
16- if rows :
17- st .success ("CSV file uploaded and parsed successfully!" )
18- st .subheader ("Extracted Rows:" )
19- # Display as a table
20- st .table (rows )
21- else :
22- st .warning ("The uploaded CSV file is empty." )
23- except Exception as e :
24- st .error (f"Failed to parse CSV file: { e } " )
25- else :
26- st .info ("Please upload a file with requirements to extract rows." )
20+ if rows :
21+ st .success ("CSV file uploaded and parsed successfully!" )
22+ st .subheader ("Extracted Rows:" )
23+ # Display as a table
24+ st .table (rows )
25+ else :
26+ st .warning ("The uploaded CSV file is empty." )
27+ except Exception as e :
28+ st .error (f"Failed to parse CSV file: { e } " )
29+
30+ if not uploaded_files :
31+ st .info ("Please upload a *.trace.csv file to extract rows." )
32+ return False
You can’t perform that action at this time.
0 commit comments