Project2 / README.md
SarahMarzouq's picture
Update README.md
2ccf05c verified

A newer version of the Gradio SDK is available: 5.21.0

Upgrade
metadata
title: Project2
emoji: 🐢
colorFrom: gray
colorTo: pink
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 Two

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 using Helsinki-NLP/opus-mt-en-ar.
  • This ensures the app provides a headline in the desired language, whether the input is in English or Arabic.

Text-to-Speech

-The app supports text-to-speech conversion for both English and Arabic. -Arabic: To convert the Arabic headline to speech using facebook/mms-tts-ara. -English: To convert the English headline to speech using microsoft/speecht5_tts.

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.

  1. Select Language: Choose between Arabic or English.
  2. Enter Article Text: Type or paste the article text from which you want to generate a headline.
  3. 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
An audio that read the headline.

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.

Text-to-Speech

Arabic Text-to-Speech: We selected facebook/mms-tts-ara for Arabic text-to-speech after evaluating multiple models. This model provided the best pronunciation and clarity, ensuring high-quality Arabic speech. English Text-to-Speech: We chose microsoft/speecht5_tts for English text-to-speech due to its superior pronunciation and clarity. As a Microsoft-developed model, it leverages state-of-the-art technology to produce natural and highly reliable speech, making it an ideal choice for our project.

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.