Spaces:
Sleeping
A newer version of the Gradio SDK is available:
5.21.0
title: Project1
emoji: 🐢
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 5.18.0
app_file: app.py
pinned: false
license: apache-2.0
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Final Project: Part One
Headlines Generation Project
This project is all about making it easier to come up with the perfect headline. The goal is to create an app that helps generate clear, engaging, and relevant headlines for articles in both Arabic and English. Instead of struggling to summarize an article, users can get an instant, well-matched headline with just a click. The app is designed to be simple and efficient, allowing users to choose their preferred language and quickly get the best possible headline without the hassle.
Pipelines
Headlines Generator
The app generates headlines based on the provided article text in English using the Michau/t5-base-en-generate-headline
model.
- If the input is in English, the headline is generated directly in English.
Translation
- If the input is in Arabic, it is first translated to English using
Helsinki-NLP/opus-mt-ar-en
, then the headline is generated in English, and finally, it is translated back to Arabic usingHelsinki-NLP/opus-mt-en-ar
. - This ensures the app provides a headline in the desired language, whether the input is in English or Arabic.
How to Use the Interface
The app uses Gradio for building a simple interface where users can select the language, input text, and receive the generated headline.
- Select Language: Choose between Arabic or English.
- Enter Article Text: Type or paste the article text from which you want to generate a headline.
- Get Headline: Once the button is clicked, a headline will be generated.
Example Input
Select Language: English
Text/Article: "Greenhouse gas emissions, primarily carbon dioxide (CO2) and methane (CH4), are the main drivers of global climate change. Human activities, such as burning fossil fuels for energy, deforestation, and industrial processes, have significantly increased the concentration of these gases in the atmosphere. According to the Intergovernmental Panel on Climate Change (IPCC), CO2 levels have risen by over 50% since the pre-industrial era, contributing to rising global temperatures."
Expected Output
Global Warming - The Main Driver of Global Climate Change
Why We Chose These Models
Headlines Generator
We selected Michau/t5-base-en-generate-headline
for headline generation because it has been trained on a collection of 500,000 articles with corresponding headings, making it well-suited for this task. The model is specifically designed to generate concise and relevant headlines from article text.
Translation
We use the Helsinki-NLP/opus-mt-ar-en
and Helsinki-NLP/opus-mt-en-ar
models to translate back and forth between Arabic and English. Since the main headline generation model does not support Arabic, we had to find a way to generate headlines in Arabic.
To achieve this, we first translate Arabic input into English so that the headline generation model can process it and produce a proper English headline. Since we want the headline to match the article's original language, we then translate the generated English headline back into Arabic before outputting it.
Because translation accuracy is crucial for maintaining the meaning of the headlines, we carefully selected our translation models based on popularity and high download rates, ensuring they are optimized specifically for Arabic and English.
Special Measures Taken to Support the Arabic Language
Since our chosen headline generation model Michau/t5-base-en-generate-headline
only supports English, we implemented a translation pipeline to ensure that Arabic inputs can be processed effectively.
To achieve this, we use the Helsinki-NLP/opus-mt-ar-en
model to translate Arabic text into English before generating a headline. Once the headline is created in English, we then use the Helsinki-NLP/opus-mt-en-ar
model to translate it back into Arabic.