Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import random
|
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
|
|
|
|
| 7 |
|
| 8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 9 |
dtype = torch.bfloat16
|
|
@@ -14,7 +15,7 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 14 |
MAX_IMAGE_SIZE = 2048
|
| 15 |
|
| 16 |
@spaces.GPU(duration=190)
|
| 17 |
-
def infer(prompt, seed=
|
| 18 |
if randomize_seed:
|
| 19 |
seed = random.randint(0, MAX_SEED)
|
| 20 |
generator = torch.Generator().manual_seed(seed)
|
|
@@ -36,14 +37,6 @@ examples = [
|
|
| 36 |
]
|
| 37 |
|
| 38 |
|
| 39 |
-
|
| 40 |
-
#css="""
|
| 41 |
-
#col-container {
|
| 42 |
-
# margin: 0 auto;
|
| 43 |
-
# max-width: 520px;
|
| 44 |
-
#}
|
| 45 |
-
#"""
|
| 46 |
-
|
| 47 |
css="""
|
| 48 |
body {
|
| 49 |
font-family: Arial, sans-serif;
|
|
|
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
|
| 7 |
+
from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5TokenizerFast
|
| 8 |
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
dtype = torch.bfloat16
|
|
|
|
| 15 |
MAX_IMAGE_SIZE = 2048
|
| 16 |
|
| 17 |
@spaces.GPU(duration=190)
|
| 18 |
+
def infer(prompt, seed=47622, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
|
| 19 |
if randomize_seed:
|
| 20 |
seed = random.randint(0, MAX_SEED)
|
| 21 |
generator = torch.Generator().manual_seed(seed)
|
|
|
|
| 37 |
]
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
css="""
|
| 41 |
body {
|
| 42 |
font-family: Arial, sans-serif;
|