Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,3 @@
|
|
| 1 |
-
# Ensure necessary packages are installed
|
| 2 |
-
!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 # Install specific version of torchvision+
|
| 3 |
-
!pip install git+https://github.com/huggingface/diffusers.git # Install latest diffusers
|
| 4 |
-
!pip install torch gradio basicsr realesrgan Pillow diffusers transformers accelerate safetensors # Install dependencies
|
| 5 |
-
|
| 6 |
# Import necessary libraries
|
| 7 |
import torch
|
| 8 |
import gradio as gr
|
|
@@ -29,7 +24,8 @@ pipe_img2img = StableDiffusionImg2ImgPipeline.from_pretrained(
|
|
| 29 |
"runwayml/stable-diffusion-v1-5",
|
| 30 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32
|
| 31 |
).to(device)
|
| 32 |
-
print("✅ Image-to-Image model loaded!"
|
|
|
|
| 33 |
|
| 34 |
# Function to generate images from text
|
| 35 |
def generate_txt2img(prompt, steps=50, guidance=7.5, width=512, height=512, seed=-1, save_format="png"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Import necessary libraries
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
|
|
|
| 24 |
"runwayml/stable-diffusion-v1-5",
|
| 25 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32
|
| 26 |
).to(device)
|
| 27 |
+
print("✅ Image-to-Image model loaded!"
|
| 28 |
+
)
|
| 29 |
|
| 30 |
# Function to generate images from text
|
| 31 |
def generate_txt2img(prompt, steps=50, guidance=7.5, width=512, height=512, seed=-1, save_format="png"):
|