The values of attributes being erased after stopping web-rtc

Hi, i have problem in saving the values of set.performedSets and set.performed Reps that are changing in the model_feedback method. the changed values are available in the same method when printing their values, however when i try to get the values in another method evaluate_exerise, the values displayed are that when initialized


class PoseEstimatorModel:
def init(self, selectedExercise):
self.performedSets = 0
self.performedReps = 0
self.repsFlag = 0

def model_feedback(self, frame, results, repetitions):
    global flag
    flag = True

    position1 = self.exerciseInfoDict["position 1"]
    position2 = self.exerciseInfoDict["position 2"]

        row = np.array(
            [[res.x, res.y, res.z, res.visibility] for res in results.pose_landmarks.landmark]).flatten()
        X = pd.DataFrame([row])
        body_language_class = self.model.predict(X)[0]
        body_language_prob = self.model.predict_proba(X)[0]

        position = body_language_class
        if position == position1 and self.performedReps == 0:
            self.performedReps = 0
        if position == position2:
            self.repsFlag = 1
        if position == position1 and self.repsFlag == 1:
            self.performedReps += 1
            self.repsFlag = 2
            if self.performedReps % repetitions == 0:
                self.performedSets += 1

        print(f'PERFORMED REPS BEFORE STOPPING: {self.performedReps}')
        print(f'PERFORMED SETS BEFORE STOPPING: {self.performedSets}')

    except Exception as e:

def evaluate_exercise(self, sets, repetitions, selectedExerciseTitle, patientUsername):
    global flag

    def recv(frame):
        frame = frame.to_ndarray(format="bgr24")
        frame = cv2.flip(frame, 1)
        frame, results = self.make_detections(frame)
        self.model_feedback(frame, results, repetitions)
        return av.VideoFrame.from_ndarray(frame, format='bgr24')

    ws = webrtc_streamer(key="key",
                         media_stream_constraints={"video": True, "audio": False},

    if ws.state.playing is False and flag is True:
        print(f'PERFORMED REPS AFTER STOPPING: {self.performedReps}')
        print(f'PERFORMED SETS AFTER STOPPING: {self.performedSets}')

        flag = False
        self.performedSets = 0
        self.performedReps = 0
        self.repsFlag = 0