im getting 2 exceptions : "System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation " and "DllNotFoundException: Unable to load DLL 'LibTorchSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
im trying to develop a webpage which performs sentiment analysis of each customer review from database , using asp.net webforms and ML.Net text classification module , i have updated all the packages but it didnt solved the problem.
my code:
main.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="sentimentanalysistrail2.main" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<body>
<form id="form1" runat="server">
<div>
</form>
</body>
</html>
main.aspx.cs:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.ML;
using System;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static Sentimentanalysistrail2.SentimentAnalysis;
namespace sentimentanalysistrail2
{
{
private PredictionEnginePool<ModelInput, ModelOutput> _predictionEnginePool;
protected void Page_Load(object sender, EventArgs e)
{
{
var serviceProvider = (IServiceProvider)Application["MlServiceProvider"];
PerformSentimentAnalysis();
}
}
{
var numberOfComments = 0;
var comments = GetCommentsFromDatabase();
foreach (var comment in comments)
{
numberOfComments++;
}
var average = (sentiment / numberOfComments) * 100;
}
private List<string> GetCommentsFromDatabase()
{
List<string> messagesList = new List<string>();
string CS = "data source=.; database = FoodieDB; integrated security=SSPI";
con.Open();
SqlCommand cmd = new SqlCommand("select Message from Contact", con);
using (SqlDataReader reader = cmd.ExecuteReader())
{
{
messagesList.Add(message);
}
}
con.Close();
return messagesList;
}
private int AnalyzeSentiment(string comment)
{
var prediction = _predictionEnginePool.Predict(input);