This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementById("summary-output").innerText = summary_text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pyodide.runPython(` | |
| import pandas as pd | |
| from io import StringIO | |
| from js import document | |
| # Load CSV | |
| df = pd.read_csv(StringIO(csv_text)) | |
| # Show first rows | |
| document.getElementById("data-output").innerText = df.head().to_string() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pyodide.runPython(` | |
| import pandas as pd | |
| from io import StringIO | |
| from js import document | |
| # Load CSV | |
| df = pd.read_csv(StringIO(csv_text)) | |
| # Show first rows | |
| document.getElementById("data-output").innerText = df.head().to_string() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pyodide.globals.set("csv_text", text); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pyodide = await loadPyodide(); | |
| await pyodide.loadPackage(["numpy", "pandas"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>Python CSV Analysis in the Browser</title> | |
| <script src="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js"></script> | |
| <style> | |
| body { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npx serve . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as WasmModule from './pkg/index.js'; | |
| // Expose the function globally for the HTML button's onclick handler for simplicity | |
| window.doMath = async () => { | |
| // The Wasm module handles instantiation when first imported/awaited | |
| const { add, greet } = await WasmModule.instantiate(fetch('./pkg/release.wasm')); | |
| const num1 = parseInt(document.getElementById('num1').value); | |
| const num2 = parseInt(document.getElementById('num2').value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <h2>Wasm 2025 Component Demo</h2> | |
| <input type="number" id="num1" value="40"> | |
| <input type"number" id="num2" value="2"> | |
| <button onclick="doMath()">Add with Wasm</button> | |
| <p id="result">Result will appear here.</p> | |
| <!-- Load our JS entry point as a module --> |
NewerOlder