Update app.py to stop download checkpoints/ocr_general_clean.pt if we already downloaded the file

#3
by theamdara - opened
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -25,8 +25,9 @@ import gradio as gr
25
  # Register refcoco task
26
  tasks.register_task('ocr', OcrTask)
27
 
28
- os.system('wget https://shuangqing-multimodal.oss-cn-zhangjiakou.aliyuncs.com/ocr_general_clean.pt; '
29
- 'mkdir -p checkpoints; mv ocr_general_clean.pt checkpoints/ocr_general_clean.pt')
 
30
 
31
  # turn on cuda if GPU is available
32
  use_cuda = torch.cuda.is_available()
 
25
  # Register refcoco task
26
  tasks.register_task('ocr', OcrTask)
27
 
28
+ if not os.path.exists("checkpoints/ocr_general_clean.pt"):
29
+ os.system('wget https://shuangqing-multimodal.oss-cn-zhangjiakou.aliyuncs.com/ocr_general_clean.pt; '
30
+ 'mkdir -p checkpoints; mv ocr_general_clean.pt checkpoints/ocr_general_clean.pt')
31
 
32
  # turn on cuda if GPU is available
33
  use_cuda = torch.cuda.is_available()