Downloads · 30 days
0
hassaanik/Language_Identifier
Language_Identifier is a machine learning model from hassaanik. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Feb 28, 2024
Repo size
330 MB
Likes
0
Public
Click a slice to open those files.
.h5312 MB · 94%
From the Hugging Face model README
This project is a Flask web application that identifies the language of input text. It uses a machine learning model trained on text data to make predictions. The user inputs text into a form on the web app, and the app returns the predicted language.
def predict_language(text, model, cv, le):
cleaned_text = clean_text(text)
text_vectorized = cv.transform([cleaned_text])
prediction = model.predict(text_vectorized)
predicted_label = le.inverse_transform([np.argmax(prediction)])[0] # Get the first element of the list
return predicted_label
sentence = 'random text'
predicted_label = predict_language(sentence, model, cv, le)
print(predicted_label)