Spaces:
Paused
Paused
Commit
·
9142a0b
1
Parent(s):
f5b7609
updating interface to integrate both models
Browse files
README.md
CHANGED
@@ -10,3 +10,22 @@ pinned: true
|
|
10 |
license: mit
|
11 |
---
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
license: mit
|
11 |
---
|
12 |
|
13 |
+
# legalis demo
|
14 |
+
|
15 |
+
#### This space is showing a demo of two models I build for a Uni Project about the prediction of court case outcomes. It's based on the similarly named legalis dataset, which contains 2800 court cases from the German Court cases. The dataset is labeled with the outcome of the case (plaintiff won or lost), extracted from the decision in text form (by ChatGPT) and the models are trained to predict the outcome based on the text of the case.
|
16 |
+
|
17 |
+
## 🔗 Links:
|
18 |
+
|
19 |
+
**[RandomForest Model on Huggingface](https://huggingface.co/LennardZuendorf/legalis-scikit)**
|
20 |
+
|
21 |
+
**[BERT Model on Huggingface](https://huggingface.co/LennardZuendorf/legalis-BERT)**
|
22 |
+
|
23 |
+
**[Labeled Dataset on Huggingface](https://huggingface.co/datasets/LennardZuendorf/legalis)**
|
24 |
+
|
25 |
+
|
26 |
+
## 👨💻 Author and Credits:
|
27 |
+
|
28 |
+
**Author:** [@LennardZuendorf](https://github.com/LennardZuendorf)
|
29 |
+
|
30 |
+
- This project is part of a course in HTW Berlin's Business Computing Bachelor Program ("Unternehmenssoftware")
|
31 |
+
|
app.py
CHANGED
@@ -1,39 +1,25 @@
|
|
1 |
-
# imports
|
2 |
import gradio as gr
|
3 |
-
from transformers import pipeline
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
# top row
|
18 |
-
with gr.Row():
|
19 |
-
gr.Markdown(
|
20 |
-
"""
|
21 |
-
# Legalis BERT Demo
|
22 |
-
Start typing below to see the output.
|
23 |
-
""")
|
24 |
-
# middle row with input text, predict button and output label
|
25 |
-
with gr.Row():
|
26 |
-
with gr.Column():
|
27 |
-
input_text = gr.Textbox(label="Case Facts")
|
28 |
-
with gr.Row():
|
29 |
-
predict = gr.Button("Predict")
|
30 |
-
with gr.Column():
|
31 |
-
label = gr.Label(label="Predicted Winner")
|
32 |
-
with gr.Row():
|
33 |
-
interpretation = gr.components.Interpretation(input_text, visible=False)
|
34 |
-
|
35 |
-
# link predict button to predict function
|
36 |
-
predict.click(predict_fun, input_text, label)
|
37 |
-
|
38 |
-
# launch command
|
39 |
-
interface.launch()
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
+
tts_examples = [
|
4 |
+
"I love learning machine learning",
|
5 |
+
"How do you do?",
|
6 |
+
]
|
7 |
|
8 |
+
scikit_demo = gr.load(
|
9 |
+
"LennardZuendorf/legalis-scikit",
|
10 |
+
src="models",
|
11 |
+
inputs=gr.Textbox(lines=5, max_lines=6, label="Input Text"),
|
12 |
+
title="scikit-learn"
|
13 |
+
)
|
14 |
|
15 |
+
bert_demo = gr.load(
|
16 |
+
"LennardZuendorf/legalis-bert",
|
17 |
+
src="models",
|
18 |
+
inputs=gr.Textbox(lines=5, max_lines=6, label="Input Text"),
|
19 |
+
title="bert"
|
20 |
+
)
|
21 |
|
22 |
+
demo = gr.TabbedInterface([scikit_demo, bert_demo], ["BERT Classification", "scikit-learn Classification"])
|
23 |
|
24 |
+
if __name__ == "__main__":
|
25 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|