Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -120,7 +120,7 @@ def generate(
|
|
120 |
torch_dtype = torch.float16
|
121 |
)
|
122 |
|
123 |
-
|
124 |
|
125 |
try:
|
126 |
|
@@ -140,6 +140,12 @@ def generate(
|
|
140 |
except Exception as e:
|
141 |
print(f"An error occurred: {e}")
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
with gr.Blocks(
|
144 |
theme=gr.themes.Soft()
|
145 |
) as demo:
|
|
|
120 |
torch_dtype = torch.float16
|
121 |
)
|
122 |
|
123 |
+
# pipe.to(device)
|
124 |
|
125 |
try:
|
126 |
|
|
|
140 |
except Exception as e:
|
141 |
print(f"An error occurred: {e}")
|
142 |
|
143 |
+
if torch.cuda.is_available():
|
144 |
+
pipe = load_pipeline(MODEL)
|
145 |
+
print("Loaded on Device!")
|
146 |
+
else:
|
147 |
+
pipe = None
|
148 |
+
|
149 |
with gr.Blocks(
|
150 |
theme=gr.themes.Soft()
|
151 |
) as demo:
|