Spaces:
Sleeping
Sleeping
Update app.py
Browse files16 unmodified lines17181920212251 unmodified lines74757677787980818283848516 unmodified linesimport classifier_data_libimport tokenizationimport joblibprint("NumPy Version:", np.__version__)print("TensorFlow Version:", tf.__version__)51 unmodified linesdataset = dataset.prefetch(tf.data.experimental.AUTOTUNE)return datasetdef launch(input):# Load the label encoderlabel_encoder = joblib.load('label_encoder.joblib')# Preprocess the new datasample_example = [input]new_data_dataset = preprocess_new_data(sample_example)# Assuming you have a model already loaded (add model loading code if needed)16 unmodified lines1718192021222351 unmodified lines757677787980818283848586878889909116 unmodified linesimport classifier_data_libimport tokenizationimport joblibfrom deep_translator import GoogleTranslatorprint("NumPy Version:", np.__version__)print("TensorFlow Version:", tf.__version__)51 unmodified linesdataset = dataset.prefetch(tf.data.experimental.AUTOTUNE)return datasetdef launch(text_input):# Load the label encoderlabel_encoder = joblib.load('label_encoder.joblib')# Preprocess the new datatry:text_input = GoogleTranslator(source = 'auto',target = 'en').translate(text_input)except:text_input = text_inputsample_example = [text_input]new_data_dataset = preprocess_new_data(sample_example)# Assuming you have a model already loaded (add model loading code if needed)
app.py+8-2