C
C#8mo ago
Mekasu0124

✅ How to work with Python A.I.'s

Ok, although I'm no where near ready to start writing my first line of code, I do want to get an idea of what I'm getting myself into. I'm building the A.I. in python and I'll be building an Avalonia desktop application that will interact with the A.I. What I'm wondering is if there are any libraries, or other, that anyone recommends that would go great with this idea? Thanks.
25 Replies
Angius
Angius8mo ago
It will be much easier to keep everything in the same language tbh So I'd recommend you write the UI in Python as well. Tkinkter or whatever other Python UI library
Mekasu0124
Mekasu0124OP8mo ago
oh ok. that makes sense
The Fog from Human Resources
You could try to setup your python Ai handler as a FLASK app and then make api to it from your GUI However, if you plan on shipping this to anyone prepare for a ton of issues cause python never "just runs" on a client machine
Mekasu0124
Mekasu0124OP8mo ago
no no no shipping lol it's being made specifically to me. The end goal is to have a UI that I can put what I want into a text box with specific keywords in my statement so like create a new avalonia desktop application named MyApp using the CommunityToolkit.Mvvm package instead of the Avalonia.ReactiveUI package and use the file structure for a multi-app editor setup
create a new avalonia desktop application
dotnet new avalonia.mvvm -n MyApp -o MyApp
using the CommunityToolkit.Mvvm package instead of the Avalonia.ReactiveUI package
⚠️after everything else is done cd MyApp && dotnet remove package Avalonia.ReactiveUI && dotnet add package CommunityToolkit.Mvvm
and use the file structure for a multi-app editor setup
this is where it would build the file structure that another user here gave me. Name escapes me
Cross-Platform App File Structure

.
├── MyProj.sln
├── .gitignore
├── .editorconfig
└── src/
├── MyProj.Common/
│ ├── MyProj.Common.csproj
│ └── Models/
│ └── Stuff.cs
├── MyProj.Desktop/
│ ├── MyProj.Desktop.csproj
│ └── Program.cs
└── MyProj.Infrastructure/
├── MyProj.Infrastructure.csproj
└── Database.cs
Cross-Platform App File Structure

.
├── MyProj.sln
├── .gitignore
├── .editorconfig
└── src/
├── MyProj.Common/
│ ├── MyProj.Common.csproj
│ └── Models/
│ └── Stuff.cs
├── MyProj.Desktop/
│ ├── MyProj.Desktop.csproj
│ └── Program.cs
└── MyProj.Infrastructure/
├── MyProj.Infrastructure.csproj
└── Database.cs
and then it would cd into the Desktop application project under ./src and add/remove the packages. I'll likely set it up too to prompt me if there are anymore packages with hints like databases and api's so that I don't forget them 😂
The Fog from Human Resources
If you really do want to go with 2 seperate languages I'd recommend the REST approach as it's the simplest to connect things that aren't directly related
Mekasu0124
Mekasu0124OP8mo ago
as in java script? that would be a nice approach for the mobile app version of this little guy. the desktop version, I'm going to use the same language to build the AI. I just don't know how I'm going to get a flat line across the ui page and then make that line dance around all erratic when the ai speaks a respnose lol which to be fair, I don't know how to do that in any language
Angius
Angius8mo ago
Why Javascript?
Mekasu0124
Mekasu0124OP8mo ago
that was the language that came to mind
Lex Li
Lex Li8mo ago
There are quite a few mistakes showing in your statements. 1) Mixing multiple languages won't give you any real benefits, as you won't be able to master all of them quickly. 2) What's the AI you referred to? AI models like GPT have so many wrappers, so you can easily use a wrapper for .NET, such as Semantic Kernel from Microsoft. 3) Avalonia UI can take you anywhere, desktop, mobile and web, so focus on one thing like desktop first, and stop bothering yourself with mobile/web at this stage.
Jimmacle
Jimmacle8mo ago
also, expecting a LLM to give you any serious code is a mistake to begin with it would be faster to follow your instructions as you wrote them here than try and goad a LLM into producing the same output "multi-app editor setup" is ambiguous even for a human person, i certainly wouldn't know exactly what you meant by that without an example the most use i get out of LLMs in terms of codegen is repeating existing patterns in my code, and even then it gets it wrong too often to trust
Mekasu0124
Mekasu0124OP8mo ago
ok so after a lengthy conversation with my friend last night, I used the wrong term. apologies. I'm techincally just creating a bunch of functions that make the different types of projects that I create and work with on my personal computer, so, not an a.i., but a small assistant program, and I've negated the use case for it on mobile so it's just going to be a desktop app so basically it'll just be a private piece of software that I made that will have buttons and inputs that I'll nagivate to create the project I'm wanting instead of having to do all of the manual stuff thanks for the help though you guys!
Jimmacle
Jimmacle8mo ago
can you not already do this with custom .NET project templates?
Mekasu0124
Mekasu0124OP8mo ago
ok so I know nothing about templates. Templates aren't a bad idea, however, I'm making the program more personal as it's just being built for me. I did try and go the node.js route with doing it so that I could just run npm create_project in the terminal, however, I wasn't as successful at it as I thought I would be lol
Jimmacle
Jimmacle8mo ago
my point is mostly don't reinvent the wheel, if the environment you're in has a project template feature it would be better to use that than to start from scratch afaik IDEs pull these templates in as well so you'll see them in the relevant options when creating projects there
Mekasu0124
Mekasu0124OP8mo ago
I got you. On a separate note of the assistant that I'm building, I want it to be able to speak it's responses to me like alexa does. I know how to make python speak using pyttsx3, however, I've never done that in C#. Is it possible?
Jimmacle
Jimmacle8mo ago
probably, find an API that does that and use a C# library to talk to it
Mekasu0124
Mekasu0124OP8mo ago
Mekasu0124
Mekasu0124OP8mo ago
I'm just doing research on it for now, however, my end goal is to have a small image of my favorite seven deadly sins character be in the corner of the desktop app, and when they speak, it'll speak their responses outloud, and write them into a chat box icon
blueberriesiftheywerecats
but how does client run both gui and api? running 2 separate app sounds like it would work weird
The Fog from Human Resources
Your GUI runs the api on a hidden CLI task I made a renderer / encoder for Media that calls on a core written in batch
blueberriesiftheywerecats
so i also have to check every possible way of quiting my gui app, so api can also be stopped properly
The Fog from Human Resources
Alternatively you catch the event of the program closing and then killing your api process with it C# can do that.
The Fog from Human Resources
But note that your time is limited You can still run code when your program closes but you have very limited time to do so
Want results from more Discord servers?
Add your server