import gradio as gr from transformers import pipeline examples = [ """The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.""", """Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face """, """Wool is a versatile and durable natural fiber that has been used for thousands of years to make various textile products. To turn wool into yarn, the wool fibers must undergo a series of processing steps. The first step in this process is called shearing, which involves using electric clippers to remove the wool from the animal's body. This process is typically done once a year, and the wool is sorted by color, texture, and length. After shearing, the wool fibers are washed to remove any dirt, grease, or impurities. This is an important step, as it ensures that the wool is clean and ready for further processing. The washed wool is then carded, which involves combing the fibers to align them in the same direction. This step helps to remove any tangles and ensures that the fibers are evenly distributed. Once the wool fibers have been carded, they are ready for spinning. Spinning is the process of twisting the wool fibers together to form yarn. This can be done using a spinning wheel, which allows the spinner to control the thickness and texture of the yarn. The spun yarn is then wound onto bobbins or spindles, ready for weaving or knitting. Overall, the process of turning wool into yarn is a complex and time-consuming process that requires skill, patience, and attention to detail. """ ] summarizer = pipeline("summarization", model="philschmid/flan-t5-base-samsum") def summarize(text): return summarizer(text, max_length=130, min_length=30, do_sample=False)['summary_text'] iface = gr.Interface( fn=summarize, inputs='text', outputs='text', examples=examples ) iface.launch()