Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# Create a text generation pipeline using Transformers | |
text_generation_pipeline = pipeline("text-generation", model="nlpaueb/legal-bert-base-uncased") # 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"), | |
) | |
if __name__ == "__main__": | |
iface.launch() | |