| import matplotlib.pyplot as plt | |
| import gradio as gr | |
| def stars(n): | |
| plt.figure(figsize=(20,20), facecolor=(0.5, 0.5, 0.5)) | |
| for i, j in zip(range(1,n), range(n, 1, -1)): | |
| plt.plot([0, i], [j, 0], "k", linewidth=1) | |
| plt.plot([0, -i], [j, 0], "w", linewidth=1) | |
| plt.plot([0, i], [-j, 0], "w", linewidth=1) | |
| plt.plot([0, -i], [-j, 0], "k", linewidth=1) | |
| plt.axis('off') | |
| return plt.gcf() | |
| iface = gr.Interface( | |
| fn=stars, | |
| inputs=gr.Slider(1, 100, 1), # Updated to use gr.Slider | |
| outputs="plot" | |
| ) | |
| iface.launch() | |