2023-07-07 01:43:49 +08:00
|
|
|
<!doctype html>
|
2023-06-27 15:09:50 +08:00
|
|
|
<!-- An entrypoint for the Wasm version development -->
|
2023-07-07 01:43:49 +08:00
|
|
|
<html style="margin: 0; padding: 0; height: 100%">
|
2023-06-27 15:09:50 +08:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta
|
|
|
|
name="viewport"
|
|
|
|
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
|
|
<link
|
|
|
|
rel="preconnect"
|
|
|
|
href="https://fonts.gstatic.com"
|
|
|
|
crossorigin="anonymous"
|
|
|
|
/>
|
2023-06-30 17:07:28 +08:00
|
|
|
|
|
|
|
<script type="module" src="./src/lite/index.ts"></script>
|
2023-06-27 15:09:50 +08:00
|
|
|
</head>
|
|
|
|
|
2023-07-07 01:43:49 +08:00
|
|
|
<body style="margin: 0; padding: 0; height: 100%">
|
2023-06-27 15:09:50 +08:00
|
|
|
<div id="gradio-app"></div>
|
2023-06-30 15:24:35 +08:00
|
|
|
|
|
|
|
<textarea id="code-input" cols="30" rows="10">
|
|
|
|
import gradio as gr
|
|
|
|
|
2023-07-05 02:29:27 +08:00
|
|
|
def greet(name):
|
|
|
|
return "Hello " + name + "!"
|
2023-06-30 15:24:35 +08:00
|
|
|
|
|
|
|
def upload_file(files):
|
|
|
|
file_paths = [file.name for file in files]
|
|
|
|
return file_paths
|
|
|
|
|
2023-07-06 18:38:15 +08:00
|
|
|
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
2023-06-30 15:24:35 +08:00
|
|
|
name = gr.Textbox(label="Name")
|
|
|
|
output = gr.Textbox(label="Output Box")
|
|
|
|
greet_btn = gr.Button("Greet")
|
|
|
|
greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
|
|
|
|
|
|
|
|
gr.File()
|
|
|
|
|
|
|
|
file_output = gr.File()
|
|
|
|
upload_button = gr.UploadButton("Click to Upload a File", file_types=["image", "video"], file_count="multiple")
|
|
|
|
upload_button.upload(upload_file, upload_button, file_output)
|
|
|
|
|
|
|
|
demo.launch()
|
2023-07-07 01:43:49 +08:00
|
|
|
</textarea
|
|
|
|
>
|
2023-06-30 15:24:35 +08:00
|
|
|
<button id="exec-button">Execute</button>
|
2023-06-30 17:07:28 +08:00
|
|
|
|
2023-07-04 21:11:22 +08:00
|
|
|
<textarea id="requirements-input"></textarea>
|
|
|
|
<button id="install-button">Install</button>
|
2023-06-27 15:09:50 +08:00
|
|
|
</body>
|
|
|
|
</html>
|