Files
phpy/examples/gradio/first.php
2024-01-26 16:55:30 +08:00

13 lines
414 B
PHP

<?php
$operator = PyCore::import("operator");
$builtins = PyCore::import("builtins");
$os = PyCore::import('os');
foreach ($_ENV as $k => $v) {
$os->environ[$k] = $v;
}
$gr = PyCore::import('gradio');
$demo = $gr->Interface(fn: function ($name, $intensity) {
return str_repeat("Hello ", $intensity) . $name . "!";
}, inputs: new PyList(["text", "slider"]), outputs: new PyList(["text"]));
$demo->launch();