Spaces:
Sleeping
Sleeping
lorenzoscottb
commited on
Commit
β’
9bbdcc4
1
Parent(s):
5a493cf
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
3 |
|
4 |
path_to_L_model = str(os.environ['path_to_L_model'])
|
5 |
path_to_S_model = str(os.environ['path_to_S_model'])
|
6 |
read_token = str(os.environ['read_token'])
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
title = "DSA II"
|
9 |
|
10 |
description_main = """
|
11 |
A set of models to perform sentiment analysis. Choose between Large-Multilingual or Small-En-only.
|
12 |
|
|
|
13 |
Select one of the two pages to start querying one of the two models.
|
14 |
"""
|
15 |
|
@@ -28,9 +39,9 @@ examples = [
|
|
28 |
]
|
29 |
|
30 |
interface_words = gr.Interface(
|
31 |
-
fn=
|
32 |
-
inputs=
|
33 |
-
outputs=
|
34 |
description=description_main,
|
35 |
)
|
36 |
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
import pandas as pd
|
4 |
|
5 |
path_to_L_model = str(os.environ['path_to_L_model'])
|
6 |
path_to_S_model = str(os.environ['path_to_S_model'])
|
7 |
read_token = str(os.environ['read_token'])
|
8 |
|
9 |
+
|
10 |
+
languages = pd.read_csv("model_lang.csv", names=["Lang_acr"])
|
11 |
+
|
12 |
+
def check_lang(lang_acronym):
|
13 |
+
if lang_acronym in languages["Lang_acr"].to_list():
|
14 |
+
return "True"
|
15 |
+
else:
|
16 |
+
return "False"
|
17 |
+
|
18 |
title = "DSA II"
|
19 |
|
20 |
description_main = """
|
21 |
A set of models to perform sentiment analysis. Choose between Large-Multilingual or Small-En-only.
|
22 |
|
23 |
+
Use the interface to check if a language is included in the multilingual model, using language acronyms (e.g. it for Italian).
|
24 |
Select one of the two pages to start querying one of the two models.
|
25 |
"""
|
26 |
|
|
|
39 |
]
|
40 |
|
41 |
interface_words = gr.Interface(
|
42 |
+
fn=check_lang,
|
43 |
+
inputs="text",
|
44 |
+
outputs="text",
|
45 |
description=description_main,
|
46 |
)
|
47 |
|