File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -30,21 +30,14 @@ export function CsvUploadButton({
3030 const { addCell } = useAddCell ( ) ;
3131 const { uploadFile, isUploading } = useFileUpload ( {
3232 notebookId : store . storeId ,
33- onFileUploaded : ( artifactId , fileName ) => {
33+ onFileUploaded : ( { fileName } ) => {
3434 toast . success ( `File uploaded: ${ fileName } ` ) ;
3535 // Create a new code cell with CSV loading code
3636 const newCellId = addCell ( cellId , "code" , position ) ;
3737
3838 // Set the cell content to load the CSV
3939 const csvCode = `import pandas as pd
40- import pyodide
41-
42- # Load CSV file: ${ fileName }
43- dataset_url = "/api/artifacts/${ artifactId } "
44- df = pd.read_csv(pyodide.http.open_url(dataset_url))
45-
46- # Display basic info about the dataset
47- print(f"Dataset shape: {df.shape}")
40+ df = pd.read_csv('${ fileName } ')
4841df.head()` ;
4942
5043 store . commit (
Original file line number Diff line number Diff line change @@ -6,7 +6,13 @@ import { events } from "@runtimed/schema";
66
77interface FileUploadOptions {
88 notebookId : string ;
9- onFileUploaded ?: ( artifactId : string , fileName : string ) => void ;
9+ onFileUploaded ?: ( {
10+ artifactId,
11+ fileName,
12+ } : {
13+ artifactId : string ;
14+ fileName : string ;
15+ } ) => void ;
1016}
1117
1218const sleep = ( ms : number ) => new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
@@ -67,7 +73,7 @@ export const useFileUpload = ({
6773 ) ;
6874
6975 setIsUploading ( false ) ;
70- onFileUploaded ?.( result . artifactId , file . name ) ;
76+ onFileUploaded ?.( { artifactId : result . artifactId , fileName : file . name } ) ;
7177
7278 return result . artifactId ;
7379 } ,
You can’t perform that action at this time.
0 commit comments