-
Notifications
You must be signed in to change notification settings - Fork 0
/
LieDetectorController.cs
40 lines (34 loc) · 1.04 KB
/
LieDetectorController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.AspNetCore.Mvc;
namespace LieDetectorApp.Controllers
{
public class LieDetectorController : Controller
{
[HttpGet]
public IActionResult Index()
{
return View(); // Return the Index view to show the form
}
[HttpPost]
public IActionResult SubmitData(int heartRate, int gsr)
{
// Simulate lie detection prediction logic
string prediction = PredictLie(heartRate, gsr);
// Pass the prediction result to the View
ViewBag.Prediction = prediction;
// Return the Prediction view, passing the result
return View("Prediction");
}
private string PredictLie(int heartRate, int gsr)
{
// Simple threshold-based logic
if (heartRate > 100 && gsr > 30)
{
return "Likely Lying";
}
else
{
return "Likely Truthful";
}
}
}
}