Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,18 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
import
|
4 |
-
import
|
5 |
-
import
|
|
|
|
|
6 |
|
7 |
-
model = "tiiuae/falcon-7b"
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
do_sample=True,
|
16 |
-
top_k=10,
|
17 |
-
num_return_sequences=1,
|
18 |
-
eos_token_id=tokenizer.eos_token_id,
|
19 |
-
)
|
20 |
-
for seq in sequences:
|
21 |
-
print(f"Result: {seq['generated_text']}")
|
22 |
-
pipeline = transformers.pipeline(
|
23 |
-
"text-generation",
|
24 |
-
model=model,
|
25 |
-
tokenizer=tokenizer,
|
26 |
-
torch_dtype=torch.bfloat16,
|
27 |
-
trust_remote_code=True,
|
28 |
-
device_map="auto",
|
29 |
-
)
|
30 |
|
31 |
|
|
|
|
1 |
+
pip install tensorflow keras_cv --upgrade --quiet
|
2 |
+
import time
|
3 |
+
import keras_cv
|
4 |
+
from tensorflow import keras
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
model = keras_cv.models.StableDiffusion(img_width=512, img_height=512)
|
7 |
+
images = model.text_to_image("photograph of an astronaut riding a horse", batch_size=3)
|
8 |
|
|
|
9 |
|
10 |
+
def plot_images(images):
|
11 |
+
plt.figure(figsize=(20, 20))
|
12 |
+
for i in range(len(images)):
|
13 |
+
ax = plt.subplot(1, len(images), i + 1)
|
14 |
+
plt.imshow(images[i])
|
15 |
+
plt.axis("off")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
+
plot_images(images)
|