zhiweili
commited on
Commit
Β·
f023e9e
1
Parent(s):
6e0dbac
test generated_image
Browse files- app_tensorrt.py +6 -7
app_tensorrt.py
CHANGED
|
@@ -45,16 +45,15 @@ compiledModel = torch.compile(
|
|
| 45 |
},
|
| 46 |
dynamic=False,
|
| 47 |
)
|
| 48 |
-
print('Model compiled!')
|
| 49 |
|
| 50 |
-
|
| 51 |
-
torch_tensorrt.save(compiledModel, "compiled_pipe.ep")
|
| 52 |
-
print('Compiled model saved!')
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
def create_demo() -> gr.Blocks:
|
|
|
|
| 45 |
},
|
| 46 |
dynamic=False,
|
| 47 |
)
|
|
|
|
| 48 |
|
| 49 |
+
base_pipe.unet = compiledModel
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
generated_image = base_pipe(
|
| 52 |
+
prompt="A beautiful sunset over the city",
|
| 53 |
+
num_inference_steps=5,
|
| 54 |
+
).images[0]
|
| 55 |
|
| 56 |
+
generated_image.save("/tmp/gradio/generated_image.png")
|
| 57 |
|
| 58 |
|
| 59 |
def create_demo() -> gr.Blocks:
|