Spaces:
Running
Running
# -*- coding: utf-8 -*- | |
"""New_Finetune.ipynb | |
Automatically generated by Colaboratory. | |
Original file is located at | |
https://colab.research.google.com/drive/1HBmhGB58E7LDJPmp4fGI-mJhRb5OZDWo | |
""" | |
streamlit run app.py | |
!pip install huggingface_hub | |
from huggingface_hub import notebook_login | |
notebook_login() | |
!pip install --upgrade diffusers[torch] | |
from torch import autocast | |
from diffusers import StableDiffusionPipeline | |
pipe = StableDiffusionPipeline.from_pretrained( | |
"CompVis/stable-diffusion-v1-4", | |
use_auth_token=True | |
).to("cuda") | |
prompt = "a sleek logo of a company, named 'SPARK', emblem style, our moto is 'Sparking some code to win', abstract logo, professinal, centre align, black background, the logo should resemble the name, clean" | |
with autocast("cuda"): | |
output = pipe(prompt) | |
print(output.keys()) | |
import matplotlib.pyplot as plt | |
import numpy as np | |
image_data = output["images"] | |
# If the image data is a list, assume it contains PIL images | |
if isinstance(image_data, list): | |
for i, image in enumerate(image_data): | |
# Convert PIL image to numpy array | |
image_np = np.array(image) | |
# Display the image using Matplotlib | |
plt.imshow(image_np) | |
plt.axis('off') | |
plt.title(f"Image {i+1}") | |
plt.show() | |
else: | |
print("Unexpected image format. Unable to display.") | |