ajayarora1235 commited on
Commit
4c2c9be
·
1 Parent(s): d7941e2

new change choices approach

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -1369,6 +1369,7 @@ def download_from_url(url, model):
1369
  shutil.copy(file_path,f'./weights/{model}.pth')
1370
  shutil.rmtree("zips")
1371
  shutil.rmtree("unzips")
 
1372
  return "Model downloaded, you can go back to the inference page!"
1373
  except:
1374
  return "ERROR - The download failed. Check if the link is valid."
@@ -1487,22 +1488,21 @@ def zip_downloader(model):
1487
  else:
1488
  return f'./weights/{model}.pth', "Could not find Index file."
1489
 
1490
- # async def download_and_change():
1491
- # await download_from_url('https://drive.google.com/uc?id=1O98vvnle_nZP8ZdpnZFLZ5TU1UZe7x0p&confirm=t', 'JVKE-main')
1492
- # await download_from_url('https://drive.google.com/uc?id=1h810cil3YRlN4pu4oO43zKq9z3cYjItp&confirm=t', 'jvke-nighttime-v4')
1493
- # change_choices()
1494
 
1495
- async def download_from_url_async(url, model):
1496
- return download_from_url(url, model)
1497
-
1498
- async def download_main():
1499
- await asyncio.gather(
1500
- download_from_url_async('https://drive.google.com/uc?id=1O98vvnle_nZP8ZdpnZFLZ5TU1UZe7x0p&confirm=t', 'JVKE-main'),
1501
- download_from_url_async('https://drive.google.com/uc?id=1h810cil3YRlN4pu4oO43zKq9z3cYjItp&confirm=t', 'jvke-nighttime-v4')
1502
- )
1503
- change_choices()
1504
 
1505
- asyncio.run(download_main())
 
 
 
1506
 
1507
  with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose"), title="Ilaria RVC 💖") as app:
1508
  with gr.Tabs():
 
1369
  shutil.copy(file_path,f'./weights/{model}.pth')
1370
  shutil.rmtree("zips")
1371
  shutil.rmtree("unzips")
1372
+ change_choices()
1373
  return "Model downloaded, you can go back to the inference page!"
1374
  except:
1375
  return "ERROR - The download failed. Check if the link is valid."
 
1488
  else:
1489
  return f'./weights/{model}.pth', "Could not find Index file."
1490
 
 
 
 
 
1491
 
1492
+ download_from_url('https://drive.google.com/uc?id=1O98vvnle_nZP8ZdpnZFLZ5TU1UZe7x0p&confirm=t', 'JVKE-main')
1493
+ download_from_url('https://drive.google.com/uc?id=1h810cil3YRlN4pu4oO43zKq9z3cYjItp&confirm=t', 'jvke-nighttime-v4')
1494
+ weight_root = "weights"
1495
+ index_root = "logs"
1496
+ names = []
1497
+ for name in os.listdir(weight_root):
1498
+ if name.endswith(".pth"):
1499
+ names.append(name)
1500
+ index_paths = []
1501
 
1502
+ for root, dirs, files in os.walk(index_root, topdown=False):
1503
+ for name in files:
1504
+ if name.endswith(".index") and "trained" not in name:
1505
+ index_paths.append("%s/%s" % (root, name))
1506
 
1507
  with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose"), title="Ilaria RVC 💖") as app:
1508
  with gr.Tabs():