Commit
·
5e9c22e
1
Parent(s):
bb7f640
Update model_t.py
Browse files- model_t.py +19 -0
model_t.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import keras_cv
|
| 3 |
+
from tensorflow import keras
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
|
| 6 |
+
model = keras_cv.models.StableDiffusion(img_width=512, img_height=512)
|
| 7 |
+
|
| 8 |
+
images = model.text_to_image("photograph of an astronaut riding a horse", batch_size=3)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def plot_images(images):
|
| 12 |
+
plt.figure(figsize=(20, 20))
|
| 13 |
+
for i in range(len(images)):
|
| 14 |
+
ax = plt.subplot(1, len(images), i + 1)
|
| 15 |
+
plt.imshow(images[i])
|
| 16 |
+
plt.axis("off")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
plot_images(images)
|