Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Create a text generation pipeline using Transformers
|
5 |
+
text_generation_pipeline = pipeline("text-generation", model="models/law-ai/InLegalBERT") # Replace with the actual model name
|
6 |
+
|
7 |
+
def generate_explanation(input_text):
|
8 |
+
# Generate a paragraph explaining the details of the input text
|
9 |
+
explanation = text_generation_pipeline(input_text, max_length=200) # Adjust max_length as needed
|
10 |
+
return explanation[0]["generated_text"]
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=generate_explanation,
|
15 |
+
inputs=gr.Textbox("text", label="Legal Document", lines=5),
|
16 |
+
outputs=gr.Textbox(label="Explanation"),
|
17 |
+
live=True,
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
iface.launch()
|