gilramos commited on
Commit
45d0f71
1 Parent(s): df18eaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -21,7 +21,41 @@ output_json_component_description = { "breakdown": """
21
  This box presents a detailed breakdown of the evaluation for each model.
22
  """}
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  pipe = pipeline("text-classification", model="knowhate/HateBERTimbau")
26
  demo = gr.Interface.from_pipeline(pipe)
27
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  This box presents a detailed breakdown of the evaluation for each model.
22
  """}
23
 
24
+ model_list = [
25
+ "knowhate/HateBERTimbau",
26
+ "knowhate/HateBERTimbau-youtube",
27
+ "knowhate/HateBERTimbau-twitter",
28
+ "knowhate/HateBERTimbau-yt-tt",
29
+ ]
30
+
31
+ user_friendly_name = {
32
+ "knowhate/HateBERTimbau": "HateBERTimbau (Original)",
33
+ "knowhate/HateBERTimbau-youtube": "HateBERTimbau (YouTube)",
34
+ "knowhate/HateBERTimbau-twitter": "HateBERTimbau (Twitter)",
35
+ "knowhate/HateBERTimbau-yt-tt": "HateBERTimbau (YouTube + Twitter)"
36
+ }
37
+
38
+ reverse_user_friendly_name = { v:k for k,v in user_friendly_name.items() }
39
+
40
+ user_friendly_name_list = list(user_friendly_name.values())
41
 
42
  pipe = pipeline("text-classification", model="knowhate/HateBERTimbau")
43
  demo = gr.Interface.from_pipeline(pipe)
44
+ demo.launch()
45
+
46
+
47
+
48
+ inputs = [
49
+ gr.Textbox(label="Text", value=app_examples[0][0]),
50
+ gr.Dropdown(label="Model", choices=user_friendly_name_list, value=user_friendly_name_list[0])
51
+ ]
52
+
53
+ outputs = [
54
+ gr.Label(label="Result"),
55
+ gr.Markdown(),
56
+ ]
57
+
58
+
59
+ gr.Interface(fn=predict, inputs=inputs, outputs=outputs, title=app_title,
60
+ description=app_description,
61
+ examples=app_examples).launch()