Skip to content

Commit fb9ef38

Browse files
committed
add lightningignore (fixes app crash in the cloud) and code cleanup
1 parent 9105675 commit fb9ef38

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.lightningignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git/

app.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ class MasterpieceCreator(ServeGradio):
77
outputs = gr.outputs.Image(type="auto", label="Your masterpiece is ready")
88
enable_queue = True
99

10-
def __init__(self, *args, **kwargs):
11-
super().__init__(*args, **kwargs)
12-
1310
def predict(self, prompt):
14-
da = self.model.create(
11+
results = self.model.create(
1512
text_prompts=prompt,
1613
width_height=[512, 512],
1714
n_batches=1,
1815
)
19-
da[0].load_uri_to_image_tensor()
20-
return da[0].tensor
16+
result = results[0]
17+
result.load_uri_to_image_tensor()
18+
return result.tensor
2119

2220
def build_model(self):
2321
import discoart
2422
return discoart
2523

2624

27-
app = L.LightningApp(MasterpieceCreator(cloud_compute=L.CloudCompute("gpu-fast")))
25+
app = L.LightningApp(MasterpieceCreator(cloud_compute=L.CloudCompute("gpu")))

0 commit comments

Comments
 (0)