Spaces:
Runtime error
Runtime error
Commit
·
2f8a733
1
Parent(s):
cf8b666
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,15 +53,19 @@ def main():
|
|
| 53 |
|
| 54 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
st.title("BAYC Text to IMAGE generator")
|
| 57 |
st.write(f"Stable diffusion model is fine-tuned by lora using dataset {DATASET_REPO}")
|
| 58 |
|
| 59 |
sample = Image.open(SAMPLE_IMAGE)
|
| 60 |
-
st.image(sample, caption="An ape with solid gold fur and beanie")
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
st.write(f"Model is loaded in {elapsed} seconds!")
|
| 65 |
|
| 66 |
prompt = st.text_input(
|
| 67 |
label="Write prompt to generate your unique BAYC image! (e.g. An ape with golden fur)")
|
|
@@ -71,7 +75,7 @@ def main():
|
|
| 71 |
seed = st.text_input(label="Seed for images")
|
| 72 |
|
| 73 |
if prompt and num_images and seed:
|
| 74 |
-
st.write(f"Generating {num_images} BAYC image with prompt {prompt}
|
| 75 |
|
| 76 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 77 |
images = []
|
|
@@ -81,7 +85,7 @@ def main():
|
|
| 81 |
|
| 82 |
st.write("Done!")
|
| 83 |
|
| 84 |
-
st.image(images, width=150, caption=f"Generated Images with {prompt}")
|
| 85 |
|
| 86 |
if __name__ == '__main__':
|
| 87 |
main()
|
|
|
|
| 53 |
|
| 54 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 55 |
|
| 56 |
+
elapsed, pipeline = elapsed_time(load_pipeline_w_lora)
|
| 57 |
+
pipeline = pipeline.to(device)
|
| 58 |
+
|
| 59 |
+
st.write(f"Model is loaded in {elapsed} seconds!")
|
| 60 |
+
|
| 61 |
st.title("BAYC Text to IMAGE generator")
|
| 62 |
st.write(f"Stable diffusion model is fine-tuned by lora using dataset {DATASET_REPO}")
|
| 63 |
|
| 64 |
sample = Image.open(SAMPLE_IMAGE)
|
| 65 |
+
st.image(sample, caption="Example image with prompt <An ape with solid gold fur and beanie>")
|
| 66 |
|
| 67 |
+
|
| 68 |
+
|
|
|
|
| 69 |
|
| 70 |
prompt = st.text_input(
|
| 71 |
label="Write prompt to generate your unique BAYC image! (e.g. An ape with golden fur)")
|
|
|
|
| 75 |
seed = st.text_input(label="Seed for images")
|
| 76 |
|
| 77 |
if prompt and num_images and seed:
|
| 78 |
+
st.write(f"Generating {num_images} BAYC image with prompt <{prompt}>...")
|
| 79 |
|
| 80 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 81 |
images = []
|
|
|
|
| 85 |
|
| 86 |
st.write("Done!")
|
| 87 |
|
| 88 |
+
st.image(images, width=150, caption=f"Generated Images with <{prompt}>")
|
| 89 |
|
| 90 |
if __name__ == '__main__':
|
| 91 |
main()
|