Spaces:
Runtime error
Runtime error
dinalzein commited on
Commit Β·
0eab03f
1
Parent(s): 015eea5
remove method
Browse files
app.py
CHANGED
|
@@ -33,13 +33,6 @@ def identify_language(txt):
|
|
| 33 |
return languages_map[id2label[str(y_pred[0])]]
|
| 34 |
|
| 35 |
|
| 36 |
-
def identify_language2(txt):
|
| 37 |
-
tokenized_txt = tokenizer(txt, return_tensors='pt')
|
| 38 |
-
output = model(**tokenized_txt)
|
| 39 |
-
predictions = torch.nn.functional.softmax(output.logits, dim=-1)
|
| 40 |
-
_, preds = torch.max(predictions, dim=-1)
|
| 41 |
-
return languages_map[id2label[str(preds.item())]]
|
| 42 |
-
|
| 43 |
#with gr.Row():
|
| 44 |
examples = [
|
| 45 |
"C'est La Vie",
|
|
@@ -78,7 +71,7 @@ article = ('''## Suppoted Langauges \n
|
|
| 78 |
|
| 79 |
|
| 80 |
gr.Interface(
|
| 81 |
-
fn=
|
| 82 |
inputs=inputs,
|
| 83 |
outputs=outputs,
|
| 84 |
verbose=True,
|
|
|
|
| 33 |
return languages_map[id2label[str(y_pred[0])]]
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
#with gr.Row():
|
| 37 |
examples = [
|
| 38 |
"C'est La Vie",
|
|
|
|
| 71 |
|
| 72 |
|
| 73 |
gr.Interface(
|
| 74 |
+
fn=identify_language,
|
| 75 |
inputs=inputs,
|
| 76 |
outputs=outputs,
|
| 77 |
verbose=True,
|