Spaces:
Runtime error
Runtime error
File size: 634 Bytes
5197b29 6a40291 5197b29 150e17e 5197b29 150e17e 5197b29 52edfe4 632ab01 1205ebf 5197b29 52edfe4 5197b29 fdbddc8 5197b29 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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() |