python
gradio
YeeKal
•
•
"#python"
gradio: Build & Share Delightful Machine Learning Apps
快速部署模型推理前端
A simple text2text demo
import gradio as gr
def question_answer(context, question):
return ("the answer is {}".format(question), 0.7)
gr.Interface(fn=question_answer, inputs=["text", "text"], outputs=["textbox", "text"]).launch()
allow remote access in LAN
demo.launch(server_name="0.0.0.0")
# demo.launch(ssl_verify=False, share=False,debug=False,server_name="0.0.0.0")
ChatInterface
similar to gr.Interface, but is specifically designed for chatbot UIs
import random
import gradio as gr
def random_response(message, history):
return random.choice(["Yes", "No"])
demo = gr.ChatInterface(random_response)
demo.launch()