Loading repository data…
Loading repository data…
Munya-Marinda / repository
This website utilizes the Hugging Face API to generate image descriptions based on user-provided text input. The application is built with HTML, CSS, and JavaScript, and it leverages the facebook/bart-large-cnn model for generating textual summaries.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This website utilizes the Hugging Face API to generate image descriptions based on user-provided text input. The application is built with HTML, CSS, and JavaScript, and it leverages the facebook/bart-large-cnn model for generating textual summaries.
Get your Hugging Face API token:
If you don't have an API token, you need to create an account on Hugging Face and obtain your API token.
Clone the repository:
git clone https://github.com/Munya-Marinda/huggingface-inference-api-with-javascript
cd fusion-image-generator-website
Open the HTML file:
Open index.html in your preferred web browser.
Update the API token:
Open the script.js file and replace xxxxxxxxxxxxxxxxxxx with your Hugging Face API token:
Authorization: "Bearer xxxxxxxxxxxxxxxxxxx",
Enter text and generate summary:
Here is a snippet of the JavaScript code used in this application:
const callAPI = () => {
console.log("callAPI. Hello World!");
const paragraph = document.getElementById("text-input");
const output = document.getElementById("text-output");
const text = paragraph.value;
async function query(data) {
const response = await fetch(
"https://api-inference.huggingface.co/models/facebook/bart-large-cnn",
{
headers: {
Authorization: "Bearer xxxxxxxxxxxxxxxxxxx",
},
method: "POST",
body: JSON.stringify(data),
}
);
const result = await response.json();
return result;
}
query({
inputs: text,
}).then((response) => {
output.innerHTML = response[0]?.summary_text;
});
};
xxxxxxxxxxxxxxxxxxx with your actual Hugging Face API token.This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or suggestions.
For any questions or support, please contact [munyathedev@gmail.com].