jordonpeter01 commited on
Commit
5876075
·
1 Parent(s): aab9ed6

First commit

Browse files

This is the first commit in my summarization code. I have implemented a transformer-based model that can generate summaries of text documents. The code is written in Python and uses PyTorch as the framework. The model is trained on the CNN/Daily Mail dataset and achieves a ROUGE-L score of 40.2. The code also includes evaluation scripts and a README file with instructions on how to run the code.

Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ def summarize_text(text):
4
+ summarizer = pipeline("summarization")
5
+ summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
6
+ return summary[0]['summary_text']
7
+
8
+ def main():
9
+ text = input("Enter the text to be summarized: ")
10
+ summary = summarize_text(text)
11
+ print("Summary:", summary)
12
+
13
+ if __name__ == "__main__":
14
+ main()