LOADING
GIPHY’s Public API Guide

GIPHY’s Public API Guide

IT technologies are influencing almost all spheres of our lives today. The need for new personnel is growing every year. In the future, this trend will only intensify. This article contains Proxet ML Team research and recommendations for those who want to carefully and quickly learn and keep up with the industry.

How to Use the Giphy API

To get started, you’ll first need to visit GIPHY’s developer dashboard and generate an API key. If you plan to use the API on multiple OS, you’ll need to create a unique key for each one.

After that, you will need to set up a search endpoint and trending endpoint. The trending endpoint automatically suggests to the user recent popular GIFs, and the search endpoint allows them to search GIPHY’s library of millions of images.

Indeed, IT has affected almost everything – from car-sharing to bills payment, from online entertainment to healthcare, from mechanical engineering to the expanded list of possible remote jobs.

You may also want to incorporate analytics into your app. GIPHY uses GIPHY Analytics to improve search results for your users. By calling their Action Register Endpoint each time a user views, clicks, or sends a GIF or Sticker, Giphy will be able to customize our responses to your user’s behavior. We highly recommend calling this endpoint on every user action in your app.

To add analytics to your app, head to our Action Register Endpoint.

The Road to the GIF Search API

In 2017, GIPHY partnered with Proxet to develop different parts of GIPHY’s API, the internal system for managing application clients, search engine optimization algorithms, recognition of celebrity faces, and other technological solutions.

Image by Proxet. Proxet to Develop Different Parts of GIPHY’s API
Proxet to Develop Different Parts of GIPHY’s API

Before the product could get to a place where it was ready for a public API, the underlying model had to be trained, refined, and maintained.

The task was a technically complex one — because GIPHY, is in essence, based on machine vision — the AI has to be able to identify relevant images — which is already a challenge. Secondly, the image tags are input by users themselves, meaning that GIPHY has no direct control over the relevance of the tags.

This created significant difficulties for dataset training and a solution had to be found.

Expert Voting

The solution, which GIHPY developed in cooperation with Proxet, was a dataset training system called “Expert Voting”.

In essence, this system allows the leveraging similarity measures in those embedding spaces of GIFs to infer GIF’s tags by looking into the tags and other similarity measures of its neighbors. By doing this, the system is better able to learn what tags are more strongly associated with what type of image, and provide better search results to users.

Developing the Expert Voting model involved the use of a wide variety of tech stacks, including;

  • ResNet50 Imagenet embeddings 
  • → TRN MIT visual embeddings
  • → Internal semantic model for GIFs representations
  • → OpenGPT2 representations of OCR results

Working with GIPHY was one of the most interesting technical challenges we’ve ever worked on, and in developing the model we leveraged all of our technical expertise in AI/ML, dataset building, and building integration-ready software. I couldn’t be more proud of the way my team rose to the challenge and delivered.

Ihor Kroosh, Machine Learning Engineer at Proxet.
Auto Tagging

The long term goal of improving search suggestions, was to eventually enable the system to tag GIFs automatically — thereby reducing the dirty data input by users directly.

The experiments done in the second half of the project’s implementation were conducted through Amazon Sagemaker, and relied mainly on architectures written in PyTorch because of its simplicity, convenience, and optimization.

We also leveraged the Catalyst framework, which allowed us to structure PyTorch experiments in a clean and concise way, enabling engineers to avoid rewriting the same training loop every time. Furthermore, Catalyst provides an intuitive high-level interface over extremely handy PyTorch tools we benefited from:

Distributed Data Parallel – distributed mode for PyTorch, allow use of multiple GPU devices

Apex – PyTorch extension with NVIDIA utilities for mixed precision and distributed training

Torch JIT – modern way to serialize and optimize PyTorch models for inference

We used these tools in conjunction with a user-friendly interface for GIPHY called “GIF Edit”, a pop up that allows users to edit their own uploaded GIFs. If the user doesn’t input any data, the auto tagging model will suggest tags. If the user does add tags, then the model will suggest further tags based on those already entered.

The results of applying this model in conjunction with the UX speak for themselves. Just look at the results:

  • Percentage of uploaded GIFs without tags dropped down by 45%
  • Percentage of uploaded GIFs with one tag dropped by more than 13%
  • Percentage of uploaded GIFs with multiple tags increased by 2%
  • Average number of tags per uploaded GIF increased by almost 39%

With these results achieved, the system was now ready for public access.

How to Use GIPHY Keys and Make Your First Request

As we mentioned earlier in the article, the GIPHY API key can be accessed from the developer dashboard. Once you’ve completed those steps, you are limited only by your imagination in terms of how you implement the API in your project, as long it’s based on HTTP enabled coding language.

When you are ready to get your API key, you will need to provide GIPHY with the following information, according to their site:

Please make the subject of your email “API Key Request”. This is important as it will help us keep track of your request. In the body of your email please provide the following:

  • Your app name with brief description, web / app store links, etc.
  • What is the ‘live date’ of the app or feature that integrates with the API? Briefly describe how the Giphy API integrates with your app, including any screenshots if it helps.
  • As per our section 5 A of our terms of service, we require all apps that use the Giphy API to conspicuously display “Powered By Giphy” attribution marks. You can find approved official logo marks here. In your email, please attach a screenshot of your app that shows the attribution marks. If you do not include them you will be requested for them so please include them in your initial request to expedite the process.

For more details, refer to the Giphy api documentation. In addition, you can find lots of useful information on the GIPHY Developers hub.

Real API Usage

With so many possible use cases, it can be difficult to decide how to get started. If you need inspiration, you can head over to GIPHY Lab to see some real life examples of the API in action.  We’ve selected a few of our favourites below;

GIPHYPress

GIPHYPress is a GIPHY API plugin for WordPress that allows users to easily embed GIFS into their posts.

We love this plugin because sometimes, a picture really is worth a thousand words! And GIF images are a great way to increase reader engagement and attention, in addition to just sometimes expressing the point better than any sentence could.

GIPHY Chrome Extension

This extension puts GIPHY’s GIF search engine right at your fingertips from within the chrome web browser. You can do this for posts, message boards, emails, or anything else you can think of.

The only thing to keep in mind is that the GIF may or may not display properly, depending on the settings of the web site or web app you are using. In cases where direct display of the GIF is not supported, the extension will insert a link instead. 

Random Goat

This one’s just a fun, random GIF website. Type a word into Random Goat’s search bar and it will show you an infinite series of GIFs that match your search criteria. Great for integrations with screen savers, or putting up on the projector at an office party. And the goat is pretty cute too.

MailChimp

A well-placed GIF is a great way to brighten up your email marketing campaigns, and even get users to look forward to reading to them.  Whether you’re looking to underscore a point in a newsletter or brighten the reader’s mood so much that they just have to click “buy now”, this integration can help you to do that.

Making Your First GIPHY API Request

GIPHY Upload API

While the API everyone is most familiar with is probably the search function, but why limit yourself to other people’s ideas? The upload API allows the artistically-inclined and pop-culture savvy to create and upload their own GIFs. 

The best way to do this is through is GIPHYs existing tool, GIPHY capture. With this tool, any Mac user can record HD video from their computer and upload it as GIF.

The applications of this tool are limitless. For example, it could be used to create a line of branded GIFs for your organization’s marketing, featuring your logo or a character you have designed.

If you aren’t creating your own content, but uploading it from somewhere else, you will definitely want to be sure to include the source url, to give credit to the original author.

Also be sure that you’ve entered the public/private settings that you want. Setting your GIF to private means it can’t be viewed by anyone except you and that other users can’t download it from GIPHY.

What is the source url on GIPHY? It’s simply the url of the original source.

The Takeaway

GIPHY’s public API offers developers a flexible way to add GIF search to their products. Especially if you are developing an app focused on messaging and text communication, it’s worth considering this method to include the web’s most popular memes and images into your communication functionality.

At Proxet, we’re very proud of the work we were able to do on this project. We have deep expertise in developing custom-software solutions for enterprise. If you are looking for a place to work on exciting projects like this and advance your career in software development, please get in touch. 

GIPHY’s Public API Guide