AhsanShahid commited on
Commit
f310226
·
verified ·
1 Parent(s): 5bbe467

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -1,7 +1,7 @@
1
- from transformers import pipeline, AutoModelForSeq2SeqLM, AutoTokenizer
2
- from flask import Flask, request, jsonify
3
  # Assuming 'model_path' is the path to your saved model
4
- model_path = '/content/drive/My Drive/T5_samsum'
5
 
6
  # Load the fine-tuned model and tokenizer
7
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
@@ -11,12 +11,19 @@ summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
11
 
12
  # Input text for summarization
13
  input_text = """
14
- Your long text that you want to summarize goes here.
15
- It can be a document or any lengthy content you need to condense.
16
- """
17
 
 
 
 
 
 
 
 
 
 
 
18
  # Perform summarization
19
- summary = summarizer(input_text, max_length=150, min_length=50, length_penalty=2.0)
20
 
21
  # Print the generated summary
22
  print("Summary:", summary[0]['summary_text'])
 
1
+ # prompt: give me inference of my code
2
+
3
  # Assuming 'model_path' is the path to your saved model
4
+ model_path = '/content/drive/MyDrive/ahsan'
5
 
6
  # Load the fine-tuned model and tokenizer
7
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
 
11
 
12
  # Input text for summarization
13
  input_text = """
 
 
 
14
 
15
+ The logjam coincided with the Bohra community leader’s arrival at the Sindh Governor House.
16
+
17
+ In an alert posted at 7:38pm, the Karachi Traffic Police s aid Ziauddin Ahmed road going towards PIDC Chowk to the State Life Building was opened for one-track traffic coming and going.
18
+
19
+ Sindh Chief Minister Murad Ali Shah took notice of the traffic situation and ordered the administration, district and traffic police to open roads for traffic.
20
+
21
+ He also instructed that traffic management in the city be improved and further directed that the CM Secretariat be reported to after the opening of roads.
22
+
23
+
24
+ """
25
  # Perform summarization
26
+ summary = summarizer(input_text, max_length=50, min_length=20, length_penalty=2.0)
27
 
28
  # Print the generated summary
29
  print("Summary:", summary[0]['summary_text'])