Spaces:
Running
Running
Commit
路
bc51159
1
Parent(s):
26c8ca4
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,23 +2,27 @@ 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 |
read_token_ii = str(os.environ['read_token_ii'])
|
| 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: version
|
| 19 |
|
| 20 |
description_main = """
|
| 21 |
-
A set of pre-trained LLMs tuned to perform sentiment analysis. You can choose between a
|
| 22 |
|
| 23 |
Use the current interface to check if a language is included in the multilingual model, using language acronyms (e.g. it for Italian).
|
| 24 |
Click on one of the upper buttons to select and start querying one of the two models.
|
|
@@ -32,6 +36,10 @@ description_S = """
|
|
| 32 |
A BERT-base-cased model pre-trained and tuned on English data.
|
| 33 |
"""
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
example_main = ["en", "it", "pl"]
|
| 36 |
|
| 37 |
examples = [
|
|
@@ -40,6 +48,12 @@ examples = [
|
|
| 40 |
["艢ledzi艂 mnie niebieski potw贸r, ale si臋 nie ba艂em. By艂em spokojny i zrelaksowany."],
|
| 41 |
]
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
interface_words = gr.Interface(
|
| 44 |
fn=check_lang,
|
| 45 |
inputs="text",
|
|
@@ -61,11 +75,19 @@ interface_model_S = gr.Interface.load(
|
|
| 61 |
name=path_to_S_model,
|
| 62 |
description=description_S,
|
| 63 |
examples=examples[0],
|
| 64 |
-
title="DSA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
api_key=read_token_ii,
|
| 66 |
)
|
| 67 |
|
| 68 |
gr.TabbedInterface(
|
| 69 |
-
[interface_words, interface_model_L, interface_model_S],
|
| 70 |
-
["Intro", "Large Multilingual", "Base En"]
|
| 71 |
).launch()
|
|
|
|
| 2 |
import os
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
+
path_to_generation_model = str(os.environ['path_to_generation_model'])
|
| 6 |
+
|
| 7 |
path_to_L_model = str(os.environ['path_to_L_model'])
|
| 8 |
path_to_S_model = str(os.environ['path_to_S_model'])
|
| 9 |
+
|
| 10 |
read_token = str(os.environ['read_token'])
|
| 11 |
read_token_ii = str(os.environ['read_token_ii'])
|
| 12 |
|
| 13 |
languages = pd.read_csv("model_lang.csv", names=["Lang_acr"])
|
| 14 |
|
| 15 |
+
|
| 16 |
def check_lang(lang_acronym):
|
| 17 |
if lang_acronym in languages["Lang_acr"].to_list():
|
| 18 |
return "True"
|
| 19 |
else:
|
| 20 |
return "False"
|
| 21 |
|
| 22 |
+
title = "DSA: version III"
|
| 23 |
|
| 24 |
description_main = """
|
| 25 |
+
A set of pre-trained LLMs tuned to perform sentiment analysis. You can choose between a Multilingual or English-only.
|
| 26 |
|
| 27 |
Use the current interface to check if a language is included in the multilingual model, using language acronyms (e.g. it for Italian).
|
| 28 |
Click on one of the upper buttons to select and start querying one of the two models.
|
|
|
|
| 36 |
A BERT-base-cased model pre-trained and tuned on English data.
|
| 37 |
"""
|
| 38 |
|
| 39 |
+
description_G = """
|
| 40 |
+
A t5 model tuned to performer text-generation, and predict emotion as well as the character experiencing those emotions.
|
| 41 |
+
"""
|
| 42 |
+
|
| 43 |
example_main = ["en", "it", "pl"]
|
| 44 |
|
| 45 |
examples = [
|
|
|
|
| 48 |
["艢ledzi艂 mnie niebieski potw贸r, ale si臋 nie ba艂em. By艂em spokojny i zrelaksowany."],
|
| 49 |
]
|
| 50 |
|
| 51 |
+
examples_g = [
|
| 52 |
+
["I'm in an auditorium. Susie S is concerned at her part in this disability awareness spoof we are preparing. I ask, 'Why not do it? Lots of AB's represent us in a patronizing way. Why shouldn't we represent ourselves in a good, funny way?' I watch the video we all made. It is funny. I try to sit on a folding chair. Some guy in front talks to me. Merle is in the audience somewhere. [BL]"],
|
| 53 |
+
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
interface_words = gr.Interface(
|
| 58 |
fn=check_lang,
|
| 59 |
inputs="text",
|
|
|
|
| 75 |
name=path_to_S_model,
|
| 76 |
description=description_S,
|
| 77 |
examples=examples[0],
|
| 78 |
+
title="DSA Base English-Only",
|
| 79 |
+
api_key=read_token_ii,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
interface_model_G = gr.Interface.load(
|
| 83 |
+
name=path_to_generation_model,
|
| 84 |
+
description=description_G,
|
| 85 |
+
examples=examples_g,
|
| 86 |
+
title="DSA Generation",
|
| 87 |
api_key=read_token_ii,
|
| 88 |
)
|
| 89 |
|
| 90 |
gr.TabbedInterface(
|
| 91 |
+
[interface_words, interface_model_L, interface_model_S, interface_model_G],
|
| 92 |
+
["Intro", "Large Multilingual", "Base En", "En Generation"]
|
| 93 |
).launch()
|