We are excited to announce the integration with Replicate. 🎊 Replicate is a service that lets us run pre-trained machine-learning models in the cloud. You can also use it to host our own public and private models. With this integration, developers can significantly speed up the development process and create more advanced AI apps. You can use different Replicate models such as
openai/whisper and more to build amazing AI powered apps.
Amazing Use Cases with Replicate Integration
With Replicate integration, the possibilities are endless. Here are some of the amazing use cases you can build with Replicate integration:
Image to Image Translation: You can use the
stability-ai/stable-diffusionmodel to translate images from one domain to another. For example, you can translate a photo of a cat to a photo of a dog.
Image Restoration: You can use the
tencentarc/gfpganmodel to increase the resolution of an image. For example, you can increase the resolution of a low-resolution photo.
Age to Face Translation: You can use the
yuval-alaluf/sammodel to translate an age to a face. For example, you can translate a 30-year-old face to a 50-year-old face.
Convert Audio to Text: You can use the
openai/whispermodel to convert audio to text. For example, you can convert a voice recording to text.
Image from drawing: You can use the
jagilley/controlnet-scribblemodel to convert a drawing to an image. For example, you can convert a drawing of a turtle to a photo of a turtle.
Midjourney like image generation: You can use the
prompthero/openjourneymodel to generate images like Midjourney. For example, you can generate a photo of a person in a car.
More will be added soon...
On top of that, you can also use Stripe integration to accept payments from your users with subscription plans. Also, you can define credit limits for your users and charge them based on the usage of your app.
Of course, you can use Replicate integration to build many more amazing apps. You can find more Replicate models here.
Building Your First AI Powered App with Replicate
Getting API key from Replicate
To use Replicate integration, you need to get an API key from Replicate. To do this, you can visit the Replicate website and click on the Sign Up button. After you sign up, you can visit the Account page and copy the API token.
Adding Replicate API token to Altogic
Now open Altogic Designer and visit the Parameters view of the Settings to create a new application parameter for the API token as Replicate and select the type as Text.
Creating a new data model to store the response
Before creating data model for the response, let's take a look the below diagram, here we will check the status field of the response to see if the prediction is completed or not. Then, if status is succeeded, we need to store the response in the database, otherwise, we can show the response to the user without storing it.
Now, let's open Altogic Designer and create a new model. Click on the Add button and select Model from JSON. Copy and paste the following JSON to the editor and click on the Next button.
The response json will be as follows:
"prompt": "oak tree with boletus growing on its branches"
"logs": "Using seed: 36941...",
After controlling the field types you can click Next and define model name as
predictions and click Finish.
You can also use the Replicate API documentation to get the response json.
- In this example we will use the
sczhou/codeformermodel. It is robust Face Restoration algorithm for old photos. You can find the documentation here.
Watch the video below to see how to create a new model in Altogic with using Model from JSON option.
Creating a new endpoint and services for text generation
After the model is created, you can create new endpoints and services to create a prediction and get a prediction. To do this, visit the Endpoints view of the Altogic Designer and follow the steps as shown in the video below.
In the video, you can see the steps for creating a new endpoint and service in Altogic, as well as how to utilize the Replicate nodes to create a prediction, get a prediction, and save the response to a database. It also shows how to test the endpoint using the Altogic Tester and view generated images in the Altogic Navigator.
- If you want to build more complex apps with different features, like credit limits, subscription plans, and more, you can use the Stripe integration to accept payments from your users. You can find the SaaS starter application from here.
In this article, we took a look at how to use Replicate integration to build AI powered apps in minutes. We also learn some of the amazing use cases you can build with it. We hope you enjoyed this article. If you have any questions, please feel free to reach out to us at community forum or discord channel.