j-min commited on
Commit
46711d5
Β·
1 Parent(s): 342816e

Use cuda when available

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -45,7 +45,10 @@ class Instance:
45
 
46
  def load_model(self, model_id='j-min/IterInpaint-CLEVR'):
47
  pipe = StableDiffusionInpaintPipeline.from_pretrained(model_id)
48
- pipe = pipe.to('cuda')
 
 
 
49
  def dummy(images, **kwargs):
50
  return images, False
51
  pipe.safety_checker = dummy
@@ -727,10 +730,10 @@ with Blocks(
727
  gr.HTML(thank_desc)
728
 
729
  main.queue(concurrency_count=1, api_open=False)
730
- # main.launch(share=False, show_api=False, show_error=True)
731
- main.launch(
732
- server_name="0.0.0.0",
733
- share=True,
734
- # server_port=7864,
735
- show_api=False, show_error=True
736
- )
 
45
 
46
  def load_model(self, model_id='j-min/IterInpaint-CLEVR'):
47
  pipe = StableDiffusionInpaintPipeline.from_pretrained(model_id)
48
+
49
+ if torch.cuda.is_available():
50
+ pipe = pipe.to('cuda')
51
+
52
  def dummy(images, **kwargs):
53
  return images, False
54
  pipe.safety_checker = dummy
 
730
  gr.HTML(thank_desc)
731
 
732
  main.queue(concurrency_count=1, api_open=False)
733
+ main.launch(share=False, show_api=False, show_error=True)
734
+ # main.launch(
735
+ # server_name="0.0.0.0",
736
+ # share=True,
737
+ # # server_port=7864,
738
+ # show_api=False, show_error=True
739
+ # )