połaczaenie bE

This commit is contained in:
Szymon Obst 2023-12-18 18:42:10 +01:00
parent f9dbc54bb2
commit 31fde0ad1b
3 changed files with 21 additions and 10 deletions

View File

@ -19,6 +19,9 @@ const Hero = () => {
let number_of_defenders = 0;
let number_of_strikers = 0;
let shooterX = 0;
let shooterY = 0;
// zmienne globalne bedace danymi wejsciowymi do modelu
@ -60,14 +63,16 @@ const Hero = () => {
if (ball) {
var x = ball.style.left;
var y = ball.style.top;
var query = "http://localhost:5000/LRegresion" + x + "&" + y
var query = "http://localhost:5000/LRegresion" + shooterX + "&" + shooterY
fetch(query).then(
res=> res.json()
).then(
data => {
setData(data)
console.log(data)
}
)
alert(data.response)
} else {
alert('Piłka nie jest obecnie na boisku.');
}
@ -75,17 +80,23 @@ const Hero = () => {
/* Funkcja dodająca listener do boiska*/
function boiskoListener(){
var x = event.clientX - footballField.getBoundingClientRect().left;
var y = event.clientY - footballField.getBoundingClientRect().top;
shooterX = (x * 105)/600
shooterY = ((400 - y) * 69)/ 400
// Przypadek kiedy zaznaczamy strzelca
if(active_bbt == "bbt1"){
var existingBall = document.querySelector('.football');
if (!existingBall) {
var ball = document.createElement('div');
ball.className = 'football';
ball.style.left = x + 'px';
ball.style.top = y + 'px';
footballField.appendChild(ball);
} else {
alert('Możesz dodać tylko jedną piłkę!');
}

View File

@ -16,11 +16,11 @@ def members():
@app.route("/LRegresion<x>&<y>")
def LRegresion(x,y):
x = int(x[0:2])
y = int(y[0:2])
x = round(x,2)
y = round(y,2)
response = LogisticRegression_predict_proba(9.23, -2.24, 9.5, 13.67, 13, 3, 0, 1, 0)
return {"response":[str(response),"proces"]}
response = LogisticRegression_predict_proba(x, y, 9.5, 13.67, 13, 3, 0, 1, 0)
return {"response":[str(response)]}
# uruchomienie serwera
if __name__ == "__main__":