Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
# Load the pre-trained IndicBART model for summarization | |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
# Example Hindi conversation | |
conversation = """ | |
व्यक्ति 1: तुम कहाँ जा रहे हो? | |
व्यक्ति 2: मैं बाजार जा रहा हूँ, कुछ ताजे फल लानी हैं। | |
व्यक्ति 1: अच्छा, प्लीज कुछ सेब ले आना। | |
व्यक्ति 2: बिल्कुल, सेब लाऊँगा। और कुछ चाहिए? | |
व्यक्ति 1: हाँ, मुझे केले और अनार भी चाहिए। | |
व्यक्ति 2: ठीक है, मैं सब कुछ ले आऊँगा। | |
""" | |
# Perform Abstractive Summarization on the conversation | |
summary = summarizer(conversation, max_length=50, min_length=30, do_sample=False) | |
# Output the summarized conversation | |
print("Original Conversation:", conversation) | |
print("\nSummarized Conversation:", summary[0]['summary_text']) | |