Allow pull data from python all the way through to the UI

This commit is contained in:
2026-02-17 21:14:20 -08:00
parent 8d599be940
commit 26c995877e
3 changed files with 20 additions and 7 deletions
+6 -2
View File
@@ -1,4 +1,5 @@
using Python.Runtime;
using System.Text.Json;
namespace PythonInterop {
@@ -29,10 +30,13 @@ namespace PythonInterop {
}
}
public void PredictAI() {
public double[] PredictAI() {
using (Py.GIL()) {
dynamic main = Py.Import("ai-predictor");
dynamic result = main.Predict();
string result = main.Predict();
double[]? predictions = JsonSerializer.Deserialize<double[]>(result);
double[] nullCasted = predictions != null ? predictions : [];
return nullCasted;
}
}