| 41 | } |
| 42 | |
| 43 | function extractImage( |
| 44 | data: Record<string, unknown>, |
| 45 | ): NotebookOutputImage | undefined { |
| 46 | if (typeof data['image/png'] === 'string') { |
| 47 | return { |
| 48 | image_data: data['image/png'].replace(/\s/g, ''), |
| 49 | media_type: 'image/png', |
| 50 | } |
| 51 | } |
| 52 | if (typeof data['image/jpeg'] === 'string') { |
| 53 | return { |
| 54 | image_data: data['image/jpeg'].replace(/\s/g, ''), |
| 55 | media_type: 'image/jpeg', |
| 56 | } |
| 57 | } |
| 58 | return undefined |
| 59 | } |
| 60 | |
| 61 | function processOutput(output: NotebookCellOutput) { |
| 62 | switch (output.output_type) { |