Exemplo n.º 1
0
        public NeuroModel()
        {
            _pythonExecName = "python3";
            #if DEBUG
            _pythonExecName = "/home/gosha20777/anaconda3/bin/python";
            #endif
            var appPath    = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            var modelName  = "resnet50_liza_alert_v1_interface.h5";
            var modelPatch = $"{appPath}/python/snapshots/{modelName}";
            _fileNameParameter = $"{appPath}/python/inference.py --model {modelPatch}";

            _client = new RestApiClient("http://127.0.0.1:5000/");
        }
Exemplo n.º 2
0
        public async Task <List <string> > GetTags(string imageName = "gosha20777/test")
        {
            var baseUrl = "https://registry.hub.docker.com";

            try
            {
                var client   = new RestApiClient(baseUrl);
                var result   = new List <string>();
                var response = new DockerTagResponse {
                    Next = baseUrl + $"/v2/repositories/{imageName}/tags/"
                };

                while (!string.IsNullOrEmpty(response.Next) && response.Next.Contains(baseUrl))
                {
                    var jsonResp = await client.GetAsync(response.Next.Remove(0, baseUrl.Length));

                    response = JsonConvert.DeserializeObject <DockerTagResponse>(jsonResp);
                    result.AddRange(response.Images.Select(image => image.Tag).ToList());
                }

                var resTags = new List <string>();
                foreach (var r in result)
                {
                    var prefix = "";
                    if (IS_GPU)
                    {
                        prefix = $"gpu-{API_VER}.";
                        if (r.Contains(prefix))
                        {
                            resTags.Add(r.Replace(prefix, ""));
                        }
                    }
                    else
                    {
                        prefix = $"{API_VER}.";
                        if (!r.Contains("gpu") && r.Contains(prefix))
                        {
                            resTags.Add(r.Replace(prefix, ""));
                        }
                    }
                }
                return(resTags);
            }
            catch (Exception e)
            {
                throw new Exception($"Unable to retrieve tag(s): {e.Message}");
            }
        }
Exemplo n.º 3
0
 public NeuroModel()
 {
     _client = new RestApiClient("http://127.0.0.1:5000/");
     _docker = new Docker();
 }