Coder Social home page Coder Social logo

memeai's Introduction

Welcome to the Meme.AI backend!

Introduction

This repository contains code to run our AI Meme Generator.

Setting up Environment

To run the Meme Generator, you will have to set up a Python environment and required enviornment variables.

Setting up Python Environment

The Meme Generator has been tested using Python 3.9. If you are able to get this running on an older version of Python, or the Meme Generator fails to run on a later version, please open an issue and we will look into it.

You can set up your Python envrionment using any method (e.g., Poetry, pipenv, conda, etc.), but please make sure you have all packages from requirements.txt installed.

NOTE: We have only tested virtualenv and pipenv. If you have success with other methods, please let us know and we can add instructions here!

Setting up Envrionment using virtualenv

  1. Create a virtual env virtualenv ~/memesAI
  2. Activate by running source ~/memesAI/bin/activate
  3. Import all the requirements from requirements.txt through pip install -r requirements.txt

Setting up Envrionment using pipenv

  1. Within this directory, run the following command: pipenv shell. This will create a new virtual environment and activate it.
  2. Install all requirements from requirements.txt via pipenv install -r requirements.txt.

Setting up Environment Variables

The Meme Generator requires three environment variables: WEAVIATE_URL, ACCESS_TOKEN, and OPENAI_API_KEY. Please note that without these, the Meme Generator may start up, but will not run. These can be set manually, or you can run the script set-env-vars to set them by running source set-env-vars.

NOTE: Before running set-env-vars, please make sure to set the variables in the script.

Test Querying and Connecting to Weaviate Instance

Prior to running the Meme Generator, you should test whether you can connect to the Weaviate instance and issue queries. There are two scripts that can be used to do this: bin/weaviate_test.py and bin/weaviate_query_test.py.

Test Connection

If you would like to test whether you can connect to the Weaviate instance, you can run bin/weaviate_test.py. This script should print out the schema on Weaviate upon successfully connecting to the Weaviate instance.

Test Querying

If you would like to test whether you can query the Weaviate instance, you can run bin/weaviate_query_test.py.

The script should return two descriptions and save two image files:

  1. "A frustrated person who is very disappointed at the outcome" - query-results-image-0.png
  2. "A sad person receiving some comfort" - query-results-image-1.png

You can double check the contents of the images by checking their "expected" counterpart:

  1. query-results-image-0.png should be expected-query-result-image-0.png
  2. query-results-image-1.png should be expected-query-result-image-1.png

If you run into any issues here, please first check if you can connect to the Weaviate instance. If you can successfully connect, please double check your OPENAI_API_KEY key and make sure there are no issues there.

Running the App

The application can be run using the following command: python manage.py runserver

NOTE: Currently, when you connect to http://127.0.0.1:8000/, you should see a Page not found error. This is expected as we currently do not have a default page. Once we have a default page, this will disappear. Thanks!

Future Work

In the future we will additionally be putting up a front end through Pynecone.

Running the Web App

pip install streamlit and streamlit-extras

The web app can be started using the following command: python -m streamlit run ./webapp/main_page.py

The web page will run at Local URL: http://localhost:80.

memeai's People

Contributors

aiswaryasankar avatar henryj18 avatar mallapraveen avatar teravolt avatar

Watchers

 avatar  avatar  avatar  avatar

memeai's Issues

Need to write test code for components of the system

We need to write code to test components of the system. Such code can be used to test the baseline code to make sure each component is functioning according to design. And then perform test for the impacted components when there is code change

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.