Adi12686 commited on
Commit
ed5d0d8
1 Parent(s): 25824eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -1,3 +1,21 @@
1
  import gradio as gr
 
2
 
3
- gr.Interface.load("models/law-ai/InLegalBERT").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()