Commit
·
b17ef3e
1
Parent(s):
0a646c7
Update app.py
Browse files
app.py
CHANGED
|
@@ -130,7 +130,8 @@ def pad_image(image):
|
|
| 130 |
def train(*inputs):
|
| 131 |
if is_shared_ui:
|
| 132 |
raise gr.Error("This Space only works in duplicated instances")
|
| 133 |
-
|
|
|
|
| 134 |
torch.cuda.empty_cache()
|
| 135 |
if 'pipe' in globals():
|
| 136 |
global pipe, pipe_is_set
|
|
@@ -545,6 +546,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 545 |
train_btn = gr.Button("Start Training")
|
| 546 |
if(is_shared_ui):
|
| 547 |
training_ongoing = gr.Markdown("## This Space only works in duplicated instances. Please duplicate it and try again!", visible=False)
|
|
|
|
|
|
|
| 548 |
else:
|
| 549 |
training_ongoing = gr.Markdown("## Training is ongoing ⌛... You can close this tab if you like or just wait. If you did not check the `Remove GPU After training`, you can come back here to try your model and upload it after training. Don't forget to remove the GPU attribution after you are done. ", visible=False)
|
| 550 |
|
|
|
|
| 130 |
def train(*inputs):
|
| 131 |
if is_shared_ui:
|
| 132 |
raise gr.Error("This Space only works in duplicated instances")
|
| 133 |
+
if not is_gpu_associated:
|
| 134 |
+
raise gr.Error("Please associate a T4 GPU for this Space")
|
| 135 |
torch.cuda.empty_cache()
|
| 136 |
if 'pipe' in globals():
|
| 137 |
global pipe, pipe_is_set
|
|
|
|
| 546 |
train_btn = gr.Button("Start Training")
|
| 547 |
if(is_shared_ui):
|
| 548 |
training_ongoing = gr.Markdown("## This Space only works in duplicated instances. Please duplicate it and try again!", visible=False)
|
| 549 |
+
elif(not is_gpu_associated):
|
| 550 |
+
training_ongoing = gr.Markdown("## Oops, you haven't associated your T4 GPU to this Space. Visit the Settings tab, associate and try again.", visible=False)
|
| 551 |
else:
|
| 552 |
training_ongoing = gr.Markdown("## Training is ongoing ⌛... You can close this tab if you like or just wait. If you did not check the `Remove GPU After training`, you can come back here to try your model and upload it after training. Don't forget to remove the GPU attribution after you are done. ", visible=False)
|
| 553 |
|