SefyanKehail commited on
Commit
7d807f6
·
1 Parent(s): 3c80605

Dropbox Models'

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -3,11 +3,18 @@ import requests
3
  import IPython.display as display
4
  import gradio as gr
5
  import multiprocessing
 
6
 
7
  def download_file(url, filename):
8
- response = requests.get(url, stream=True)
9
- with open(filename, 'wb') as file:
10
- file.write(response)
 
 
 
 
 
 
11
 
12
 
13
  model_urls = {
 
3
  import IPython.display as display
4
  import gradio as gr
5
  import multiprocessing
6
+ import os
7
 
8
  def download_file(url, filename):
9
+ if not os.path.exists(filename):
10
+ print(f"{filename} files missing. Downloading ...")
11
+ response = requests.get(url, stream=True)
12
+ with open(filename, 'wb') as file:
13
+ for chunk in response.iter_content(chunk_size=8192):
14
+ if chunk:
15
+ file.write(chunk)
16
+ else:
17
+ print(f"{filename} exists. Skipping download")
18
 
19
 
20
  model_urls = {