Esempio n. 1
0
        private static async void ProcessImage(string fileId, string path, long chatId)
        {
            try
            {
                string fileName = "./temp" + fileId + ".jpg";
                var    file     = await Bot.GetFileAsync(fileId);

                FileStream fs = new FileStream(fileName, FileMode.Create);
                await Bot.DownloadFileAsync(file.FilePath, fs);

                fs.Close();
                fs.Dispose();

                Image img = System.Drawing.Image.FromFile(fileName);

                string cl_name = predict(img);


                await Bot.SendTextMessageAsync(chatId, cl_name);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error downloading: " + ex.Message);
            }
        }