Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from torch import nn
|
|
@@ -88,7 +89,8 @@ def load_checkpoint_for_inference(filepath, model_class):
|
|
| 88 |
# loaded_model = load_checkpoint_for_inference("model_path", ClassConditionedUnet)
|
| 89 |
|
| 90 |
|
| 91 |
-
|
|
|
|
| 92 |
def generate_images(selected_class_name, num_samples):
|
| 93 |
print(f"Generating {num_samples} samples for class: {selected_class_name}")
|
| 94 |
|
|
|
|
| 1 |
+
import spaces # for using hugging face ZeroGPU
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from torch import nn
|
|
|
|
| 89 |
# loaded_model = load_checkpoint_for_inference("model_path", ClassConditionedUnet)
|
| 90 |
|
| 91 |
|
| 92 |
+
# Make this function run on GPU
|
| 93 |
+
@spaces.GPU
|
| 94 |
def generate_images(selected_class_name, num_samples):
|
| 95 |
print(f"Generating {num_samples} samples for class: {selected_class_name}")
|
| 96 |
|