All Projects → dabit3 → appsync-lambda-ai

dabit3 / appsync-lambda-ai

Licence: Apache-2.0 license
Demo of using a GraphQL resolver to hit a lambda function, then hit a few AI services, and return the response.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
Starlark
911 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to appsync-lambda-ai

bem-flashcards
Simple single-page flashcards application based on the bem-core/bem-history and BEM methodology
Stars: ✭ 19 (-59.57%)
Mutual labels:  translation
ribotricer
A tool for accurately detecting actively translating ORFs from Ribo-seq data
Stars: ✭ 20 (-57.45%)
Mutual labels:  translation
de-DE
Special German permalink sanitize
Stars: ✭ 45 (-4.26%)
Mutual labels:  translation
Localisation
Repository for translation and discussion for OpenRCT2.
Stars: ✭ 49 (+4.26%)
Mutual labels:  translation
series-formelles
Translation of, and commentary on, Joyal's classic paper "Une théorie combinatoire des séries formelles" (A combinatorial theory of formal series)
Stars: ✭ 24 (-48.94%)
Mutual labels:  translation
SimpleTranslationSystem
A simple C# translation system
Stars: ✭ 14 (-70.21%)
Mutual labels:  translation
Effective-Java-3rd-Edition-zh
📖 Effective Java (Third Edition) | Effective Java(第三版)翻译计划稿
Stars: ✭ 57 (+21.28%)
Mutual labels:  translation
bible-corpus
A multilingual parallel corpus created from translations of the Bible.
Stars: ✭ 115 (+144.68%)
Mutual labels:  translation
lost-in-translation
Uncover missing translations and localization strings in Laravel applications.
Stars: ✭ 32 (-31.91%)
Mutual labels:  translation
gf-wordnet
A WordNet in GF
Stars: ✭ 15 (-68.09%)
Mutual labels:  translation
BIFI
[ICML 2021] Break-It-Fix-It: Unsupervised Learning for Program Repair
Stars: ✭ 74 (+57.45%)
Mutual labels:  translation
dokuwiki-plugin-translation
Easily setup a multi-language DokuWiki
Stars: ✭ 22 (-53.19%)
Mutual labels:  translation
Trakt-Userscripts
Userscripts to improve and add features to Trakt.tv
Stars: ✭ 39 (-17.02%)
Mutual labels:  translation
mobility-actiontext
Translate Rails Action Text rich text with Mobility.
Stars: ✭ 27 (-42.55%)
Mutual labels:  translation
py-googletranslation
pygoogletranslation: Free and Unlimited Google translate API for Python. Translates totally free of charge.
Stars: ✭ 74 (+57.45%)
Mutual labels:  translation
YuzuMarker
🍋 [WIP] Manga Translation Tool
Stars: ✭ 76 (+61.7%)
Mutual labels:  translation
Xiaomi.eu-MIUIv12-XML-Compare
MIUI 12 XML Daily Compare for Xiaomi.eu builds
Stars: ✭ 43 (-8.51%)
Mutual labels:  translation
Deep-Learning-with-PyTorch-A-60-Minute-Blitz-cn
PyTorch1.0 深度学习:60分钟入门与实战(Deep Learning with PyTorch: A 60 Minute Blitz 中文翻译与学习)
Stars: ✭ 127 (+170.21%)
Mutual labels:  translation
CSS-Grid
CSS Grid 레이아웃 모듈 Level 1
Stars: ✭ 21 (-55.32%)
Mutual labels:  translation
i18n.cr
Internationalization API ( i18n ) for Crystal!
Stars: ✭ 36 (-23.4%)
Mutual labels:  translation

AI Enabled GraphQL with AWS AppSync

This app demonstrates how you can use a Lambda function as an AWS AppSync datasource to perform really cool operations and return the result in a GraphQL query. In this example, we build an app that allows someone to put the text they would like to translate into the app, the app then returns the translation into voice for the user to play back.

Getting Started

React Native setup

  1. clone the project
git clone https://github.com/dabit3/appsync-lambda-ai.git
  1. change directories into the project & install depencies
cd appsync-lambda-ai
yarn || npm install

Creating an S3 bucket

  1. Visit https://s3.console.aws.amazon.com/ and click Create bucket

  2. Give the bucket a name and choose defaults for all other options

  3. Update line 46 in App.js to use the bucket name you just created (replace YOURBUCKETNAME and REGION):

const mp3Url = `https://s3-REGION.amazonaws.com/YOURBUCKETNAME/${sentence}`

Setting up the Lambda function

  1. In the AWS dashboard, go to the Lambda console

  2. Create a new function by clicking on Create Function

  3. Give the function a name, choose the runtime as Node.js 12.x, choose Create a custom role for the role, give the role a name of lambda_ai_role & click Allow.

  4. Click Create Function

  5. Next, we need to add permissions to the Lambda function in order to access other services (such as S3, Polly, & Translate). To do so, go to the IAM console, go to Roles, find & choose the lambda_ai_role, and add the following policies:

  • AmazonS3FullAccess
  • AmazonPollyFullAccess
  • TranslateReadOnly
  1. Next, we need to update and add the actual lambda function we will be running! In the lambda folder of this project, there is a lambda function (index.js) & a package.json file. In lambda/index.js on line 8, replace YOURBUCKETNAME with the bucket name you used when you created the S3 bucket and the REGION where this project lives.

  2. Finally, from within the lambda directory install the dependencies and then zip the folder into a zip file using the following command:

zip -r ../translate.zip *

Upload the zip file to Lambda as the function code and click Save

AWS AppSync Setup

  1. Create a new AWS ApppSync API, choose custom schema

  2. Define the following schema

type Query {
  getTranslatedSentence(sentence: String!, code: String!): TranslatedSentence
}

type TranslatedSentence {
  sentence: String!
}
  1. Create a lambda function data source
  • Click Data Sources
  • Click NEW
  • Give the data source a name, choose AWS Lambda Function as the Data source type
  • For the region, choose the region where you created the Lamba function
  • For the Function ARN, choose the Lambda function you would like to use
  • For the Role, choose New Role
  1. Add a resolver to the getTranslatedSentence query.
  • Click on Schema in the left menu
  • On the Right (under Data Types), click on Attach next to the getTranslatedSentence field.
  • For the Data Source name, choose the new data source we just created
  • Click Save
  1. Add AppSync configuration to the project

Next, we need to edit the aws-exports.js file to specify our AppSync configuration. In the root directory of the React Native project, update aws-exports.js with your AppSync credentials:

const awsmobile = {
  'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',
  'aws_appsync_region': 'us-east-1',
  'aws_appsync_authenticationType': 'API_KEY',
  'aws_appsync_apiKey': 'da2-xxxxxxxxxxxxxxxxxxxxxxxxxx',
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].