File size: 737 Bytes
25824eb
ed5d0d8
25824eb
ed5d0d8
63db592
ed5d0d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

# Create a text generation pipeline using Transformers
text_generation_pipeline = pipeline("text-generation", model="law-ai/InLegalBERT")  # Replace with the actual model name

def generate_explanation(input_text):
    # Generate a paragraph explaining the details of the input text
    explanation = text_generation_pipeline(input_text, max_length=200)  # Adjust max_length as needed
    return explanation[0]["generated_text"]

# Create a Gradio interface
iface = gr.Interface(
    fn=generate_explanation,
    inputs=gr.Textbox("text", label="Legal Document", lines=5),
    outputs=gr.Textbox(label="Explanation"),
    live=True,
)

if __name__ == "__main__":
    iface.launch()