nateraw commited on
Commit
ab2dd65
·
1 Parent(s): 6529505

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -8,7 +8,10 @@ from PIL import Image
8
  from realesrgan import RealESRGANer
9
  from huggingface_hub import hf_hub_download
10
  import gradio as gr
 
11
 
 
 
12
  model = RRDBNet(num_in_ch=3, num_out_ch=3)
13
  upsampler = RealESRGANer(
14
  scale=4,
@@ -16,7 +19,7 @@ upsampler = RealESRGANer(
16
  model=model,
17
  tile=0,
18
  pre_pad=0,
19
- half=True,
20
  )
21
 
22
  def upsample(image):
 
8
  from realesrgan import RealESRGANer
9
  from huggingface_hub import hf_hub_download
10
  import gradio as gr
11
+ import torch
12
 
13
+ device = "cuda" if torch.cuda.is_available() else "cpu"
14
+ half = True if device == "cuda" else False
15
  model = RRDBNet(num_in_ch=3, num_out_ch=3)
16
  upsampler = RealESRGANer(
17
  scale=4,
 
19
  model=model,
20
  tile=0,
21
  pre_pad=0,
22
+ half=half,
23
  )
24
 
25
  def upsample(image):