在自己用的編輯器創(chuàng)建一個(gè)py文件,例如app.py
官網(wǎng)給的例子copy過(guò)來(lái)
import gradio as gr
def greet(name, intensity):
return "Hello, " + name + "!" * int(intensity)
demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)
demo.launch()
終端運(yùn)行
python app.py
會(huì)出來(lái)一個(gè)地址 例如 http://127.0.0.1:7861,瀏覽器打開(kāi)
想要熱加載執(zhí)行
gradio app.py