test_642_class / index.html
bmarlin96's picture
Update index.html
a09e212 verified
Raw History Blame Contribute Delete
915 Bytes
<html>
<head>
<script type="module" src="https://cdn.jsdelivr.net/npm/@pyscript/core@0.7.31/dist/core.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@pyscript/core@0.7.31/dist/core.css">
</head>
<body style="font-family: sans-serif; margin: 2em;">
<h2>Meridian inbox router</h2>
<input id="msg" size="60" placeholder="Type a message">
<button py-click="route">Route</button>
<p id="out"></p>
<p id="ver"></p>
<script type="py">
import sys
from pyscript import document
document.querySelector("#ver").innerText = "Running Python " + sys.version.split()[0] + " in your browser"
def route(event):
m = document.querySelector("#msg").value.lower()
if "invoice" in m or "payment" in m:
label = "billing"
elif "recall" in m:
label = "recall"
else:
label = "other"
document.querySelector("#out").innerText = "Label: " + label
</script>
</body>
</html>