Rici commited on
Commit
82d257c
1 Parent(s): 0b8424e

added demo

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -1,13 +1,19 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- summarizer = pipeline("summarization")
 
5
 
6
- def summarize_text(text):
7
- summarized = summarizer(text, max_length=100, min_length=30, do_sample=False)[0]
8
- return summarized["summary_text"]
 
9
 
10
- with gr.Interface(summarize_text,
11
- inputs=gr.inputs.Textbox(lines=10, placeholder="Enter text to summarize..."),
12
- outputs=gr.outputs.Textbox(placeholder="Summary will appear here...")) as iface:
13
- iface.launch()
 
 
 
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load the text summarization pipeline
5
+ summarizer = pipeline("summarization", model="EleutherAI/gpt-j-6B")
6
 
7
+ def summarize_text(input_text):
8
+ # Use the summarization pipeline to generate a summary
9
+ summary = summarizer(input_text, max_length=100, min_length=30, do_sample=False)
10
+ return summary[0]['summary_text']
11
 
12
+ # Create the Gradio interface
13
+ iface = gr.Interface(fn=summarize_text,
14
+ inputs="text",
15
+ outputs="text",
16
+ title="Text Summarization",
17
+ description="Enter some text and get a summary of it.")
18
+
19
+ iface.launch()