Spaces:
Runtime error
Runtime error
| import scipy.stats | |
| import numpy as np | |
| import gradio as gr | |
| import matplotlib.pyplot as plt | |
| plt.style.use('fivethirtyeight') | |
| theta = np.linspace(0, 1, 100) | |
| def plot_beta(alpha, beta): | |
| plt.gca().cla() | |
| plt.plot(theta, scipy.stats.beta.pdf(theta, alpha, beta)) | |
| plt.ylim(0, 4) | |
| plt.xlabel('$\\theta$') | |
| plt.ylabel('pdf value') | |
| plt.tight_layout() | |
| return plt | |
| s1 = gr.inputs.Slider(minimum=0, maximum=5, step=0.1, default=2, label="alpha") | |
| s2 = gr.inputs.Slider(minimum=0, maximum=5, step=0.1, default=2, label="beta") | |
| iface = gr.Interface(fn=plot_beta, inputs=[s1, s2], outputs="image", live=True) | |
| iface.launch() |