Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepAI Image Processing API #417

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions New_APIs/DeepAI Image Processing API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 🖼️ DeepAI Image Processing API

## Overview

The **DeepAI Image Processing API** provides a suite of advanced image processing tools powered by AI. This API offers capabilities for colorization, super-resolution, and style transfer, allowing you to enhance and transform images with cutting-edge technology. It's ideal for developers looking to integrate high-quality image processing features into their applications.

## Features

- **Colorization**: Add color to grayscale images using AI algorithms.
- **Super-Resolution**: Enhance the resolution of images, making them clearer and more detailed.
- **Style Transfer**: Apply artistic styles to images, transforming them into works of art.
- **Automatic Enhancement**: Improve image quality with automatic adjustments and corrections.

## Getting Started

### Prerequisites

- **API Key**: You need to sign up for a DeepAI account and obtain an API key. You can get your API key by visiting the [DeepAI API documentation](https://deepai.org/).

### Installation

To use the DeepAI Image Processing API in a Node.js application, you can use the built-in `fetch` function or any HTTP client library. For simplicity, this example uses `node-fetch`:

```bash
npm install node-fetch
```

## Contributor
### Revanth
30 changes: 30 additions & 0 deletions New_APIs/DeepAI Image Processing API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>DeepAI Image Processing</title>
</head>
<body>
<header>
<h1>DeepAI Image Processing</h1>
</header>
<main>
<div class="upload-section">
<input type="file" id="imageUpload" accept="image/*">
<select id="processingType">
<option value="colorizer">Colorization</option>
<option value="super-resolution">Super-Resolution</option>
<option value="style-transfer">Style Transfer</option>
</select>
<button id="processButton">Process Image</button>
</div>
<div class="result-section">
<h2>Processed Image</h2>
<img id="processedImage" src="" alt="Processed Image">
</div>
</main>
<script src="index.js"></script>
</body>
</html>
52 changes: 52 additions & 0 deletions New_APIs/DeepAI Image Processing API/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
document.getElementById('processButton').addEventListener('click', processImage);

const apiKey = 'YOUR_DEEPAI_API_KEY'; // Replace with your DeepAI API key

function processImage() {
const fileInput = document.getElementById('imageUpload');
const file = fileInput.files[0];
const processingType = document.getElementById('processingType').value;

if (!file) {
alert('Please select an image to upload.');
return;
}

const formData = new FormData();
formData.append('image', file);

let apiUrl = '';
switch (processingType) {
case 'colorizer':
apiUrl = 'https://api.deepai.org/api/colorizer';
break;
case 'super-resolution':
apiUrl = 'https://api.deepai.org/api/torch-srgan';
break;
case 'style-transfer':
apiUrl = 'https://api.deepai.org/api/deepdream';
break;
default:
return;
}

fetch(apiUrl, {
method: 'POST',
headers: {
'api-key': apiKey
},
body: formData
})
.then(response => response.json())
.then(data => {
if (data.output_url) {
document.getElementById('processedImage').src = data.output_url;
} else {
alert('Failed to process the image.');
}
})
.catch(error => {
console.error('Error processing image:', error);
alert('Error processing the image.');
});
}
13 changes: 13 additions & 0 deletions New_APIs/DeepAI Image Processing API/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions New_APIs/DeepAI Image Processing API/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "deepai-image-processing",
"version": "1.0.0",
"description": "A simple app to upload and process images using DeepAI Image Processing API",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Your Name",
"license": "ISC",
"dependencies": {
"deepai-image-processing": "file:",
"express": "^4.17.1"
}
}
8 changes: 8 additions & 0 deletions New_APIs/DeepAI Image Processing API/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');
const app = express();

app.use(express.static('public'));

app.listen(3000, () => {
console.log('Server is running on port 3000');
});
68 changes: 68 additions & 0 deletions New_APIs/DeepAI Image Processing API/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #36D1DC, #5B86E5);
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}

header {
text-align: center;
margin-bottom: 20px;
}

header h1 {
font-size: 3em;
color: #fff;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

main {
width: 90%;
max-width: 800px;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.upload-section,
.result-section {
margin-bottom: 20px;
}

.upload-section input,
.upload-section select {
margin-right: 10px;
padding: 10px;
font-size: 1em;
border: none;
border-radius: 5px;
width: 200px;
outline: none;
}

button {
padding: 10px 15px;
font-size: 1em;
background-color: #444;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}

button:hover {
background-color: #666;
}

.result-section img {
max-width: 100%;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}