Spaces:
Runtime error
Runtime error
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
import gradio as gr | |
checkpoint = "Mr-Vicky-01/conversational_sumarization" | |
tokenizer = AutoTokenizer.from_pretrained(checkpoint) | |
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint) | |
def generate_summary(text): | |
inputs = tokenizer([text], max_length=1024, return_tensors='pt', truncation=True) | |
summary_ids = model.generate(inputs['input_ids'], max_new_tokens=100, do_sample=False) | |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True) | |
return summary | |
examples = [["In the dynamic landscape of the 21st century, artificial intelligence (AI) has emerged as a cornerstone technology driving unprecedented innovation across diverse domains. From healthcare to agriculture, finance to manufacturing, AI's transformative impact is palpable. In healthcare, AI-driven diagnostic systems analyze complex medical data, empowering clinicians with insights for precise treatment planning and disease management. Moreover, AI-powered predictive analytics models forecast patient outcomes, optimizing resource allocation and enhancing healthcare delivery. In agriculture, AI-enabled drones and sensors monitor crop health, soil conditions, and weather patterns, revolutionizing farming practices for improved yield and sustainability. The financial sector harnesses AI algorithms for fraud detection, risk assessment, and algorithmic trading, enhancing market efficiency and mitigating financial risks. In manufacturing, AI-driven robotics and automation systems optimize production processes, increasing productivity and quality while reducing operational costs. Additionally, AI-powered virtual assistants and chatbots revolutionize customer service, providing personalized interactions and seamless support across digital platforms. As AI technologies evolve, ethical considerations surrounding data privacy, algorithmic bias, and job displacement come to the fore, necessitating robust governance frameworks and ethical guidelines. Nevertheless, the transformative potential of AI to drive innovation, enhance productivity, and improve human well-being remains unparalleled, heralding a future where intelligent systems augment human capabilities and redefine the possibilities of tomorrow."]] | |
demo = gr.Interface(fn=generate_summary, inputs='text',outputs='text',title='Text Summarization', examples=examples) | |
demo.launch(debug=True,share=True) |