import cv2
import json
import time
import requests
import supervision as sv

from datetime import datetime
from ultralytics import YOLO
from flask import Flask,request,Response
from multiprocessing import Process, Event

app = Flask(__name__)

@app.route('/show',methods=['POST'])
def show():
    # print(request.json)
    data = request.json["content"]
    balls = data["balls"]
    table = data["table"]
    text = f"table:{table:>3} "
    for i in range(16):
        ball = "#" if "ball"+str(i) in balls else " "
        text += f"| {i} : {ball} "
    print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'),text)
    return 'ok'
    
if __name__ == '__main__':
    app.run("0.0.0.0",threaded=True)
