antoinelouis commited on
Commit
9911f95
1 Parent(s): 26fff64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -9
app.py CHANGED
@@ -18,12 +18,51 @@ def search(question):
18
  hits = util.semantic_search(q_emb, doc_embeddings, top_k=100, score_function=util.cos_sim)[0]
19
  return {docs.loc[h['corpus_id'], 'article'] + '\n\n' + f"- Art. {docs.loc[h['corpus_id'], 'article_no']}, {docs.loc[h['corpus_id'], 'code']}" for h in hits[:5]}
20
 
21
- gr.Interface(
22
- fn=search,
23
- inputs=['text'],
24
- outputs=['textbox']*5,
25
- title="Belgian Legislation Search",
26
- description="",
27
- allow_flagging="never",
28
- examples=["Qu'est-ce que je risque si je viole le secret professionnel ?", "Mon employeur peut-il me licencier alors que je suis malade ?"]
29
- ).launch(share=False, enable_queue=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  hits = util.semantic_search(q_emb, doc_embeddings, top_k=100, score_function=util.cos_sim)[0]
19
  return {docs.loc[h['corpus_id'], 'article'] + '\n\n' + f"- Art. {docs.loc[h['corpus_id'], 'article_no']}, {docs.loc[h['corpus_id'], 'code']}" for h in hits[:5]}
20
 
21
+ title = "Belgian Legislation Search"
22
+ description = "A biencoder model was trained to retrieve relevant statutory articles to legal issues. Ask it a question in French!"
23
+ article = """
24
+ The model will return the most semantically relevant laws from a corpus of 22,633 statutory articles collected from 32 Belgian codes:
25
+
26
+ | Authority | Code | #Articles |
27
+ |-----------|-----------------------------------------------------|-----------|
28
+ | Federal | Judicial Code | 2285 |
29
+ | | Code of Economic Law | 2032 |
30
+ | | Civil Code | 1961 |
31
+ | | Code of Workplace Welfare | 1287 |
32
+ | | Code of Companies and Associations | 1194 |
33
+ | | Code of Local Democracy and Decentralization | 1159 |
34
+ | | Navigation Code | 977 |
35
+ | | Code of Criminal Instruction | 719 |
36
+ | | Penal Code | 689 |
37
+ | | Social Penal Code | 307 |
38
+ | | Forestry Code | 261 |
39
+ | | Railway Code | 260 |
40
+ | | Electoral Code | 218 |
41
+ | | The Constitution | 208 |
42
+ | | Code of Various Rights and Taxes | 191 |
43
+ | | Code of Private International Law | 135 |
44
+ | | Consular Code | 100 |
45
+ | | Rural Code | 87 |
46
+ | | Military Penal Code | 66 |
47
+ | | Code of Belgian Nationality | 31 |
48
+ | Regional | Walloon Code of Social Action and Health | 3650 |
49
+ | | Walloon Code of the Environment | 1270 |
50
+ | | Walloon Code of Territorial Development | 796 |
51
+ | | Walloon Public Service Code | 597 |
52
+ | | Walloon Code of Agriculture | 461 |
53
+ | | Brussels Spatial Planning Code | 401 |
54
+ | | Walloon Code of Basic and Secondary Education | 310 |
55
+ | | Walloon Code of Sustainable Housing | 286 |
56
+ | | Brussels Housing Code | 279 |
57
+ | | Brussels Code of Air, Climate and Energy Management | 208 |
58
+ | | Walloon Animal Welfare Code | 108 |
59
+ | | Brussels Municipal Electoral Code | 100 |
60
+ | Total | | 22633 |
61
+
62
+ """
63
+ examples = [
64
+ "Qu'est-ce que je risque si je viole le secret professionnel ?",
65
+ "Mon employeur peut-il me licencier alors que je suis malade ?",
66
+ "Mon voisin fait beaucoup de bruit, que faire ?",
67
+ ]
68
+ gr.Interface(fn=search, inputs=['text'], outputs=['textbox']*5, allow_flagging="never", title=title, description=description, article=article, examples=examples).launch()