Spaces:
Running
Running
fahad11182
commited on
Commit
•
ce73d6b
1
Parent(s):
d425d45
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,11 @@ import random
|
|
8 |
# Load the InstructPix2Pix model
|
9 |
model_id = "timbrooks/instruct-pix2pix"
|
10 |
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Load the translation model (from Arabic to English)
|
14 |
translation_model_name = 'Helsinki-NLP/opus-mt-ar-en'
|
|
|
8 |
# Load the InstructPix2Pix model
|
9 |
model_id = "timbrooks/instruct-pix2pix"
|
10 |
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
11 |
+
|
12 |
+
# Check if a GPU is available, otherwise fallback to CPU
|
13 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
14 |
+
pipe = pipe.to(device) # Move the model to the appropriate device
|
15 |
+
|
16 |
|
17 |
# Load the translation model (from Arabic to English)
|
18 |
translation_model_name = 'Helsinki-NLP/opus-mt-ar-en'
|