Spaces:
Sleeping
Sleeping
kargaranamir
commited on
Commit
•
5253665
1
Parent(s):
08f58ed
Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,8 @@ import os
|
|
24 |
|
25 |
# Define a dictionary to map model choices to their respective paths
|
26 |
model_paths = {
|
27 |
-
"
|
28 |
-
"
|
29 |
# "FT176": ["kargaranamir/FT176", 'model.bin'],
|
30 |
"NLLB": ["facebook/fasttext-language-identification", 'model.bin']
|
31 |
}
|
@@ -123,7 +123,7 @@ def merge_function(input_sentence, selected_model):
|
|
123 |
|
124 |
input_sentence = input_sentence.replace('\n', ' ')
|
125 |
|
126 |
-
# Load the FastText language identification
|
127 |
classifier = load_classifier(selected_model)
|
128 |
class_names = remove_label_prefix_list(classifier.labels)
|
129 |
class_names = np.sort(class_names)
|
@@ -142,7 +142,7 @@ def merge_function(input_sentence, selected_model):
|
|
142 |
|
143 |
# Define the Gradio interface
|
144 |
input_text = gr.Textbox(label="Input Text", value="J'ai visited la beautiful beach avec mes amis for a relaxing journée under the sun.")
|
145 |
-
model_choice = gr.Radio(choices=["
|
146 |
|
147 |
output_explanation = gr.outputs.File(label="Explanation HTML")
|
148 |
|
|
|
24 |
|
25 |
# Define a dictionary to map model choices to their respective paths
|
26 |
model_paths = {
|
27 |
+
"OpenLID": ["kargaranamir/LID201", 'model.bin'],
|
28 |
+
"GlotLID": ["cis-lmu/glotlid", 'model.bin'],
|
29 |
# "FT176": ["kargaranamir/FT176", 'model.bin'],
|
30 |
"NLLB": ["facebook/fasttext-language-identification", 'model.bin']
|
31 |
}
|
|
|
123 |
|
124 |
input_sentence = input_sentence.replace('\n', ' ')
|
125 |
|
126 |
+
# Load the FastText language identification model from Hugging Face Hub
|
127 |
classifier = load_classifier(selected_model)
|
128 |
class_names = remove_label_prefix_list(classifier.labels)
|
129 |
class_names = np.sort(class_names)
|
|
|
142 |
|
143 |
# Define the Gradio interface
|
144 |
input_text = gr.Textbox(label="Input Text", value="J'ai visited la beautiful beach avec mes amis for a relaxing journée under the sun.")
|
145 |
+
model_choice = gr.Radio(choices=["GlotLID", "OpenLID", "NLLB"], label="Select Model", value='GlotLID')
|
146 |
|
147 |
output_explanation = gr.outputs.File(label="Explanation HTML")
|
148 |
|