поменял условие на более читабельное

Automatica-3
Sergey Revyakin 2 days ago
parent 6a492a036b
commit c0ccecc270

@ -137,19 +137,29 @@ def receive_data():
print() print()
try: try:
result = 0 result = 0
if (int(freq) == 2400 and (prediction_list[0] in ['drone', 'drone_noise'] or (prediction_list[0] == 'wifi' and float(probability) >= 0.95))) or (int(freq) == 1200 and (prediction_list[0] in ['drone'] and float(probability) >= 0.95)): freq_int = int(freq)
result += 0 prediction = prediction_list[0]
if int(freq) in [915]: prob = float(probability)
result = 0
if int(freq) in []: if freq_int == 2400:
if prediction in ["drone", "drone_noise"]:
result += 0
elif prediction == "wifi" and prob >= 0.95:
result += 0
elif freq_int == 1200:
if prediction == "drone" and prob >= 0.95:
result += 8
elif freq_int == 915:
result = 0 result = 0
data_to_send={
'freq': str(freq), data_to_send = {
'amplitude': result "freq": str(freq),
#'triggered': False if result < 7 else True, "amplitude": result,
#'light_len': result }
}
response = requests.post("http://{0}:{1}/process_data".format(gen_server_ip, gen_server_port), json=data_to_send) response = requests.post("http://{0}:{1}/process_data".format(gen_server_ip, gen_server_port), json=data_to_send)
if response.status_code == 200: if response.status_code == 200:
print("Данные успешно отправлены!") print("Данные успешно отправлены!")

Loading…
Cancel
Save