Adi12686's picture
Update app.py
63db592
raw history blame
No virus
737 Bytes
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()