File size: 511 Bytes
797f80b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ff408e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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(stars, gr.inputs.Slider(1, 100, 1), "plot")

iface.launch()