Gradio 简介#
import gradio as gr
import plotly.express as px
import pandas as pd
def plotly_plot():
# prepare some data
x = ["Math", "Business", "Statistics", "IT", "Commerce"]
y = [68, 73, 82, 74, 85]
data = pd.DataFrame()
data['Subject'] = x
data['Score'] = y
# create a new plot
p = px.bar(data, x='Subject', y='Score')
return p
# show the results
outputs = gr.Plot()
demo = gr.Interface(fn=plotly_plot, inputs=None, outputs=outputs)
# demo.launch()
demo.launch(server_name="0.0.0.0", server_port=4099, share=False, inbrowser=False)
* Running on local URL: http://0.0.0.0:4099
To create a public link, set `share=True` in `launch()`.
<IPython.core.display.HTML object>