Skip to content

Commit

Permalink
Update grade examples, add gradio app example
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Jan 26, 2024
1 parent adb44a8 commit 32ddce8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions examples/gradio/first.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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();
12 changes: 12 additions & 0 deletions examples/gradio/first.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import gradio as gr

def greet(name, intensity):
return "Hello " * intensity + name + "!"

demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)

demo.launch()
4 changes: 4 additions & 0 deletions examples/gradio/flagged/log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
input 0,input 1,output,flag,username,timestamp
我的世界,6,Hello Hello Hello Hello Hello Hello 我的世界!,,,2024-01-26 16:44:04.555180
我的世界,6,Hello Hello Hello Hello Hello Hello 我的世界!,,,2024-01-26 16:44:06.572989
我的世界,6,Hello Hello Hello Hello Hello Hello 我的世界!,,,2024-01-26 16:44:16.036929

0 comments on commit 32ddce8

Please sign in to comment.