Spaces:
Running
on
Zero
Running
on
Zero
use zero gpus
Browse files- edit_app.py +6 -3
edit_app.py
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
from __future__ import annotations
|
2 |
|
3 |
-
import math
|
4 |
-
from glob import glob
|
5 |
from functools import partial
|
|
|
|
|
6 |
import random
|
|
|
7 |
|
8 |
import gradio as gr
|
9 |
import torch
|
10 |
-
|
11 |
from datasets import load_dataset
|
12 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
|
|
13 |
|
14 |
|
|
|
15 |
def generate(
|
16 |
input_image: Image.Image,
|
17 |
instruction: str,
|
|
|
1 |
from __future__ import annotations
|
2 |
|
|
|
|
|
3 |
from functools import partial
|
4 |
+
from glob import glob
|
5 |
+
import math
|
6 |
import random
|
7 |
+
from PIL import Image, ImageOps
|
8 |
|
9 |
import gradio as gr
|
10 |
import torch
|
11 |
+
|
12 |
from datasets import load_dataset
|
13 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
14 |
+
import spaces
|
15 |
|
16 |
|
17 |
+
@spaces.GPU(duration=120)
|
18 |
def generate(
|
19 |
input_image: Image.Image,
|
20 |
instruction: str,
|