innitial commit
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import matplotlib.pyplot as plt
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
def isprime(x):
|
6 |
+
if x < 2:
|
7 |
+
return False
|
8 |
+
for i in range(2, x):
|
9 |
+
if x % i == 0:
|
10 |
+
return False
|
11 |
+
return True
|
12 |
+
|
13 |
+
|
14 |
+
def stars(n):
|
15 |
+
plt.figure(figsize=(20,20), facecolor=(0.5, 0.5, 0.5))
|
16 |
+
for i, j in zip(range(1,n), range(n, 1, -1)):
|
17 |
+
plt.plot([0, i], [j, 0], "k", linewidth=1)
|
18 |
+
plt.plot([0, -i], [j, 0], "w", linewidth=1)
|
19 |
+
plt.plot([0, i], [-j, 0], "w", linewidth=1)
|
20 |
+
plt.plot([0, -i], [-j, 0], "k", linewidth=1)
|
21 |
+
plt.axis('off')
|
22 |
+
return plt.gcf()
|
23 |
+
|
24 |
+
iface = gr.Interface(stars, gr.inputs.Slider(1, 100, 1), "plot")
|
25 |
+
|
26 |
+
iface.launch()
|