Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update abstractive_summarization.py
Browse files
    	
        abstractive_summarization.py
    CHANGED
    
    | 
         @@ -8,7 +8,7 @@ model = AutoModelForSeq2SeqLM.from_pretrained("EE21/BART-ToSSimplify") 
     | 
|
| 8 | 
         
             
            def summarize_with_bart_ft(input_text):
         
     | 
| 9 | 
         
             
                inputs = tokenizer.encode("summarize: " + input_text, return_tensors="pt", max_length=1024, truncation=True)
         
     | 
| 10 | 
         
             
                summary_ids = model.generate(inputs, max_length=300, min_length=100, num_beams=1, early_stopping=False, length_penalty=1)
         
     | 
| 11 | 
         
            -
                summary = tokenizer.decode(summary_ids[0], skip_special_tokens= 
     | 
| 12 | 
         
             
                return summary
         
     | 
| 13 | 
         | 
| 14 | 
         
             
            # Function to summarize using BART-large-cnn
         
     | 
| 
         | 
|
| 8 | 
         
             
            def summarize_with_bart_ft(input_text):
         
     | 
| 9 | 
         
             
                inputs = tokenizer.encode("summarize: " + input_text, return_tensors="pt", max_length=1024, truncation=True)
         
     | 
| 10 | 
         
             
                summary_ids = model.generate(inputs, max_length=300, min_length=100, num_beams=1, early_stopping=False, length_penalty=1)
         
     | 
| 11 | 
         
            +
                summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
         
     | 
| 12 | 
         
             
                return summary
         
     | 
| 13 | 
         | 
| 14 | 
         
             
            # Function to summarize using BART-large-cnn
         
     |