Spaces:
Running
on
Zero
Running
on
Zero
rafaldembski
commited on
Commit
•
cf43e30
1
Parent(s):
d1f101b
Update app.py
Browse files
app.py
CHANGED
@@ -6,16 +6,15 @@ import torch
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
from transformers import MarianMTModel, MarianTokenizer
|
8 |
|
9 |
-
dtype = torch.
|
10 |
-
device = "
|
11 |
|
12 |
# Load the translation model and tokenizer
|
13 |
model_name = 'Helsinki-NLP/opus-mt-pl-en'
|
14 |
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
15 |
model = MarianMTModel.from_pretrained(model_name).to(device)
|
16 |
|
17 |
-
|
18 |
-
pipe = DiffusionPipeline.from_pretrained("XLabs-AI/flux-RealismLora", torch_dtype=dtype).to(device)
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
MAX_IMAGE_SIZE = 2048
|
@@ -294,4 +293,4 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=css) as demo:
|
|
294 |
api_name=False,
|
295 |
)
|
296 |
|
297 |
-
demo.launch()
|
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
from transformers import MarianMTModel, MarianTokenizer
|
8 |
|
9 |
+
dtype = torch.bfloat16
|
10 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
# Load the translation model and tokenizer
|
13 |
model_name = 'Helsinki-NLP/opus-mt-pl-en'
|
14 |
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
15 |
model = MarianMTModel.from_pretrained(model_name).to(device)
|
16 |
|
17 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=dtype).to(device)
|
|
|
18 |
|
19 |
MAX_SEED = np.iinfo(np.int32).max
|
20 |
MAX_IMAGE_SIZE = 2048
|
|
|
293 |
api_name=False,
|
294 |
)
|
295 |
|
296 |
+
demo.launch()
|