What is the process of adding an API to the most recent release of Blazor server?

SaeedP

Well-known member
Joined
Oct 21, 2020
Messages
113
Programming Experience
3-5
Hello,

What is the process for creating an instance of a class within a Blazor component and utilizing its methods?


By "latest version," I am referring to the most recent release.

thanks,

Saeed
 
I would like to integrate the Deep AI API into my project. Could you please guide me through the process?
 
??? From what I could see from the deepai.org website, you can use any language to access their API as long as that language has a way to make a web request. I don't know why they told you that their C# API is only for .NET Framework 4. You can do web requests with any of the framework versions.
 
So why whilst I have installed DeepAI and imported it into my project still see a red line under the DeepAI?

C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DeepAI;



namespace BlazorApp4.Data
{
    public static class DeepAI
    {
        public static async Task<List<Logo>> GenerateLogos(string color, string font, string imageUrl)
        {
            {
                // Initialize DeepAI client with API key
                var client = new DeepAiClient("{YOUR_API_KEY}");

                // Call GenerateLogoAsync method with user's selections
                var response = await client.GenerateLogoAsync(new GenerateLogoRequest(color, font, imageUrl));
                // Parse response and create list of logo objects
                var logos = new List<Logo>();

                foreach (var output in response.Outputs)
                {
                    logos.Add(new Logo { Color = output.Data.Color, Font = output.Data.Font, ImageUrl = output.Data.ImageUrl });
                }

                return logos;





            }

        }
    }

  
}
 
What did you install? Perhaps it isn't compatible (you installed a .net framework thing in a .net core project, for example)
 
Was it this Nuget package that you installed?
 

Latest posts

Back
Top Bottom