AhsanShahid's picture
Update app.py
f310226 verified
raw
history blame
1.21 kB
# prompt: give me inference of my code
# Assuming 'model_path' is the path to your saved model
model_path = '/content/drive/MyDrive/ahsan'
# Load the fine-tuned model and tokenizer
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
# Input text for summarization
input_text = """
The logjam coincided with the Bohra community leader’s arrival at the Sindh Governor House.
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.
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.
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.
"""
# Perform summarization
summary = summarizer(input_text, max_length=50, min_length=20, length_penalty=2.0)
# Print the generated summary
print("Summary:", summary[0]['summary_text'])