private void btnKarsilastir_Click(object sender, EventArgs e) { DeepAI_API api = new DeepAI_API(apiKey: "df10d4f7-7797-4030-b0f6-e5243e869c91"); string a = resim1.FileName; string a2 = resim2.FileName; StandardApiResponse resp = api.callStandardApi("image-similarity", new { //image1 = resim1.FileName.ToString(), //image2 = resim2.FileName.ToString(), image1 = File.OpenRead(a), image2 = File.OpenRead(a2), //File.OpenRead("C:\\path\\to\\your\\file.jpg"), }); string gelen = api.objectAsJsonString(resp.output); lblSonuc.Text = api.objectAsJsonString(resp.output).ToString(); }
public string TransferFromUrl(string contentUrl, string styleUrl) { DeepAI_API api = new DeepAI_API(_configuration.GetValue <string>("DeepAISettings:ApiKey")); StandardApiResponse resp = api.callStandardApi("fast-style-transfer", new { content = contentUrl, style = styleUrl }); return(api.objectAsJsonString(resp)); }
public string CompararImagen() { DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); StandardApiResponse resp = api.callStandardApi("image-similarity", new { image1 = File.OpenRead(@"C:\Users\juan.jose.agudelo\source\repos\DesparcheBackend\DesparcheBackend\temp\imagen1.jpeg"), image2 = File.OpenRead(@"C:\Users\juan.jose.agudelo\source\repos\DesparcheBackend\DesparcheBackend\temp\imagen2.jpeg"), }); string diferencia = api.objectAsJsonString(resp.output); return(diferencia); }
static void Main(string[] args) { DeepAI_API api = new DeepAI_API(apiKey: "c374d52f-84ce-46a6-8a4f-598ba5b9e988"); StandardApiResponse resp = api.callStandardApi("nsfw-detector", new { image = File.OpenRead(@"C:\Users\www\Desktop\1\sasha2.jpg"), }); // File.WriteAllText("file.txt", api.objectAsJsonString(resp)); Console.WriteLine(api.objectAsJsonString(resp)); Console.ReadLine(); }
public string TransferFromFile(string contentPath, string stylePath) { DeepAI_API api = new DeepAI_API(_configuration.GetValue <string>("DeepAISettings:ApiKey")); using var contentStream = File.OpenRead(contentPath); using var styleStream = File.OpenRead(stylePath); StandardApiResponse resp = api.callStandardApi("fast-style-transfer", new { content = contentStream, style = styleStream }); return(api.objectAsJsonString(resp)); }
public static int GetSimilarScore(string localFile, string hostFileUrl) { api = new DeepAI_API(apiKey: "ed6a1b7c-f7ab-428f-997f-474ea0c1e1dc"); if (api == null) { throw new InvalidOperationException("The API Ket did not work"); } // Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client StandardApiResponse resp = api.callStandardApi("image-similarity", new { image1 = File.OpenRead(localFile), // local file image2 = hostFileUrl, // host file }); var re = JsonConvert.DeserializeObject <ImageSimilarityResponse>(api.objectAsJsonString(resp.output)); return(re.distance); }
private void button2_Click(object sender, EventArgs e) { if (openFileDialog1.CheckFileExists && isFileSelected) { pictureBox1.Visible = false; MessageBox.Show("Please wait a few seconds! Your file is being uploaded and upscaled."); DeepAI_API api = new DeepAI_API(apiKey: "Enter your DeepAI Licencekey here."); StandardApiResponse resp = api.callStandardApi("torch-srgan", new { image = File.OpenRead(openFileDialog1.FileName), }); dynamic d = JObject.Parse(api.objectAsJsonString(resp)); Console.Write(d.output_url); pictureBox1.ImageLocation = d.output_url; pictureBox1.Visible = true; MessageBox.Show("Your file has been upscaled and is now available in the output folder."); } }