Browse Source

removed the direct console output for now, will add logging later

tags/v0.12
Kerry Jiang 6 years ago
parent
commit
fa2cc20fc2
1 changed files with 7 additions and 16 deletions
  1. +7
    -16
      src/TensorFlowHub/Utils.cs

+ 7
- 16
src/TensorFlowHub/Utils.cs View File

@@ -28,22 +28,14 @@ namespace Tensorflow.Hub
var fileSaveTo = Path.Combine(dirSaveTo, fileName);

if (File.Exists(fileSaveTo))
return;
Directory.CreateDirectory(dirSaveTo);
using (var wc = new WebClient())
{
//TODO:maybe you can check file's hashcode and "donglowad.info" to complete file ...
Console.WriteLine($"{fileSaveTo} already exists.");
await wc.DownloadFileTaskAsync(url, fileSaveTo);
}
else
{
if (!Directory.Exists(dirSaveTo))
Directory.CreateDirectory(dirSaveTo);

using (var wc = new WebClient())
{
await wc.DownloadFileTaskAsync(url, fileSaveTo);
}

}

}

public static async Task UnzipAsync<TDataSet>(this IModelLoader<TDataSet> modelLoader, string zipFile, string saveTo)
@@ -52,8 +44,7 @@ namespace Tensorflow.Hub
if (!Path.IsPathRooted(saveTo))
saveTo = Path.Combine(AppContext.BaseDirectory, saveTo);

if (!Directory.Exists(saveTo))
Directory.CreateDirectory(saveTo);
Directory.CreateDirectory(saveTo);

if (!Path.IsPathRooted(zipFile))
zipFile = Path.Combine(AppContext.BaseDirectory, zipFile);


Loading…
Cancel
Save