update
This commit is contained in:
parent
31fde0ad1b
commit
fc2fef33e6
@ -8,8 +8,6 @@ import { logo, menu, close } from "../assets";
|
||||
|
||||
const Hero = () => {
|
||||
|
||||
const [data,setData] = useState([{}])
|
||||
|
||||
//zmienne globalne
|
||||
|
||||
//zmienna mówiąca który przycisk jest aktywny, jest ona wykorzystywana
|
||||
@ -19,9 +17,9 @@ const Hero = () => {
|
||||
let number_of_defenders = 0;
|
||||
let number_of_strikers = 0;
|
||||
|
||||
let shooterX = 0;
|
||||
let shooterY = 0;
|
||||
|
||||
var shooterX = 0;
|
||||
var shooterY = 0;
|
||||
var eX = " ";
|
||||
// zmienne globalne bedace danymi wejsciowymi do modelu
|
||||
|
||||
|
||||
@ -34,6 +32,15 @@ const Hero = () => {
|
||||
|
||||
active_bbt = a
|
||||
}
|
||||
function changeLeg(a){
|
||||
|
||||
document.getElementById("bbt4").style.background = "white";
|
||||
document.getElementById("bbt5").style.background = "white";
|
||||
document.getElementById("bbt6").style.background = "white";
|
||||
document.getElementById(a).style.background = "grey";
|
||||
|
||||
Leg_bbt = a
|
||||
}
|
||||
|
||||
// Reset Boiska
|
||||
function resetField() {
|
||||
@ -58,13 +65,11 @@ const Hero = () => {
|
||||
|
||||
}
|
||||
// Wysłanie zapytania do serwera
|
||||
const [data,setData] = useState([{}])
|
||||
function sentQuestion() {
|
||||
var ball = document.querySelector('.football');
|
||||
if (ball) {
|
||||
var x = ball.style.left;
|
||||
var y = ball.style.top;
|
||||
var query = "http://localhost:5000/LRegresion" + shooterX + "&" + shooterY
|
||||
fetch(query).then(
|
||||
fetch("http://localhost:5000/LRegresion" + shooterX + "&" + shooterY).then(
|
||||
res=> res.json()
|
||||
).then(
|
||||
data => {
|
||||
@ -72,10 +77,12 @@ const Hero = () => {
|
||||
console.log(data)
|
||||
}
|
||||
)
|
||||
alert(data.response)
|
||||
eX = data.response
|
||||
document.getElementById("ex").innerHTML = "Ex:"+ eX
|
||||
} else {
|
||||
alert('Piłka nie jest obecnie na boisku.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Funkcja dodająca listener do boiska*/
|
||||
@ -83,12 +90,13 @@ const Hero = () => {
|
||||
|
||||
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');
|
||||
let existingBall = document.querySelector('.football');
|
||||
|
||||
if (!existingBall) {
|
||||
var ball = document.createElement('div');
|
||||
@ -137,6 +145,16 @@ const Hero = () => {
|
||||
document.getElementById("bbt3").addEventListener("click",function(){
|
||||
changePlayer("bbt3")
|
||||
},false)
|
||||
|
||||
document.getElementById("bbt4").addEventListener("click",function(){
|
||||
changeLeg("bbt4")
|
||||
},false)
|
||||
document.getElementById("bbt5").addEventListener("click",function(){
|
||||
changeLeg("bbt5")
|
||||
},false)
|
||||
document.getElementById("bbt6").addEventListener("click",function(){
|
||||
changeLeg("bbt6")
|
||||
},false)
|
||||
},[]);
|
||||
|
||||
/*zwracany komponent zawierajacy boisko*/
|
||||
@ -184,6 +202,9 @@ const Hero = () => {
|
||||
<button className="cho-defence" id = "bbt5">Noga słabsza</button>
|
||||
<button className="cho-atack" id = "bbt6">Głowa</button>
|
||||
</div>
|
||||
<div>
|
||||
<b id = "ex" className="Ex">Ex:</b>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
Binary file not shown.
@ -1,8 +1,12 @@
|
||||
from joblib import load
|
||||
import pandas as pd
|
||||
from math import sqrt
|
||||
|
||||
# Funkcja zwraca prawdopodobieństwo zdobycia gola
|
||||
def LogisticRegression_predict_proba(position_x, position_y, distance_to_goalM, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead):
|
||||
def LogisticRegression_predict_proba(position_x, position_y, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead):
|
||||
|
||||
distance_to_goalM = sqrt(( (position_x**2) + (position_y**2)))
|
||||
|
||||
model = load('regresja_logistyczna.joblib')
|
||||
X_new = pd.DataFrame(columns=['position_x', 'position_y', 'distance_to_goalM', 'angle','match_minute', 'Number_Intervening_Opponents','Number_Intervening_Teammates', 'isFoot', 'isHead'])
|
||||
X_new.loc[len(X_new.index)] = [position_x, position_y, distance_to_goalM, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead]
|
||||
|
@ -16,10 +16,13 @@ def members():
|
||||
@app.route("/LRegresion<x>&<y>")
|
||||
def LRegresion(x,y):
|
||||
|
||||
x = round(x,2)
|
||||
y = round(y,2)
|
||||
x = int(x[0:2])
|
||||
y = int(y[0:2])
|
||||
|
||||
response = LogisticRegression_predict_proba(x, y, 9.5, 13.67, 13, 3, 0, 1, 0)
|
||||
response = LogisticRegression_predict_proba(x, y, 13.67, 13, 3, 0, 1, 0)
|
||||
print(x)
|
||||
print(y)
|
||||
print(response)
|
||||
return {"response":[str(response)]}
|
||||
|
||||
# uruchomienie serwera
|
||||
|
@ -4,6 +4,10 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
|
||||
.Ex{
|
||||
font-size: 40px;
|
||||
}
|
||||
body {
|
||||
margin: 50px;
|
||||
display: grid;
|
||||
|
Loading…
Reference in New Issue
Block a user