tilents
user complete1
869c384
raw
history blame contribute delete
623 Bytes
import gradio as gr
# 自定义 HTML 和 JavaScript 代码
custom_html = """
<!DOCTYPE html>
<html>
<head>
<title>Custom JavaScript</title>
</head>
<body>
<button id="myButton">Click me</button>
<script>
document.getElementById("myButton").addEventListener("click", function() {
alert("Button clicked!");
});
</script>
</body>
</html>
"""
def greet(name):
return "Hello " + name + "!"
# 创建 Gradio 应用,嵌入自定义 HTML
with gr.Blocks() as demo:
custom_component = gr.HTML(custom_html)
gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()