Skip to content

Instantly share code, notes, and snippets.

@harish2773
Last active January 12, 2024 09:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save harish2773/12df5134b39593966845ceab8860eb37 to your computer and use it in GitHub Desktop.
Save harish2773/12df5134b39593966845ceab8860eb37 to your computer and use it in GitHub Desktop.
GSoC 2023 Work Product

GSoC 2023 Work Product

Google Summer of Code 2023

A full report on my Google Summer of Code 2023 work with AOSSIE

Project: "Social Street Smart" 👨‍💻

GSoC 2023 Report: Social Street Smart

Motive for the project

With the advent of Internet, the problems faced by the people have also grown. These include abusive languages, fake news articles, click-baits, malicious websites and security attacks. Fake news has become increasingly prevalent over the last few years. Fake news's adverse effect can be seen more and more as people’s reach to social media and to the internet is been increasing.

Summary

This was the fifth year for Social Street Smart. Building upon the work done in the previous year, this year's GSoC tasks were aimed to integrate the extension with GPT-3 and implement a rating mechanism for websites to improve their experience.

Here is a quick summary of the work done over this year:

  • 👷 A CI / CD Pipeline has been added with
    • ✅ Unit Tests for all Newly Created APIs
    • 🚀 Deployment through the GitLab Pipeline
  • ✨ New Features -
    • OpenAI GPT-3 API.
    • Rating mechanism for website.
  • 🍱 Addition of a new front-end where ever needed
  • 🐛 Fixing bugs
  • 🚀 Deployed the Updated Chrome Extension to the Chrome Webstore.

[NEW] Integration of GPT-3

The integration of the OpenAI GPT-3 API provides users with a powerful tool to gain deeper insights into specific news articles they wish to verify. To access this functionality, users are required to input their unique API key in the settings page of the Chrome extension. The API key is securely stored in the local storage of the Chrome browser and serves as the input for generating prompts for the GPT-3 model.

Once the API key is set up, users can generate up to 30 prompts using their authorized API key.The generated responses are displayed to the user, offering valuable insights and analysis regarding the news article in question.

Unit Testing [ For Newly Created Features ]

I have implemented Unit Testing into the project, that makes it much easier to validate that all the APIs are functioning properly. The tests run in GitLab's CI/CD Pipeline. Unittest was used to run the tests for the APIs.

Running the APIs locally

GPT3 API

This can be run locally in the same way as they were before GSoC 2023. The steps are as follows

# Go to the directory of the API
cd /server/Context Analysis

# Install all the requirements
pip install -r requirements.txt

# Run the server
flask run

How to Get OpenAI API Key

To access the OpenAI API and use services like GPT-3, you need to obtain an API key. Here's how you can get one:

  1. Open your web browser and visit the OpenAI website.

  2. Sign in to your OpenAI account or create a new account if you don't have one.

  3. Once logged in, navigate to the API section or developer portal.

  4. Look for the option to "Generate API Key" or something similar.

  5. Click on the button to generate a new API key.

  6. Follow any additional prompts or instructions provided by the OpenAI platform.

  7. Your API key should be generated and displayed on the screen.

Important: Treat your API key as sensitive information, similar to a password. Do not share it publicly or in unencrypted formats, as it grants access to your OpenAI account and services.

Unit Testing the APIs

Unit testing for the APIs was done using unittest . To run the tests locally

cd /server/<directory_of_the_API>
pip install -r requirements.txt
python -m unittest test_file.py

[NEW] Implementation of Rating Mechanism

The rating mechanism empowers users to provide credibility ratings for websites they visit. These ratings are collected and combined to generate a credibility score for each website. By utilizing this system, users gain valuable insights into the reliability of the sources they encounter during their browsing activities. This information enables users to make more informed decisions about the credibility of the content they consume and the websites they trust. The aggregation of user ratings helps create a collective understanding of website trustworthiness

[NEW] Upgradation of Manifest to Version 3

Manifest version 2 (MV2) and Manifest version 3 (MV3) are two versions for Chrome extensions. MV3 aims to make extensions safer and more private for users. MV3 uses event-driven scripts instead of always-on background pages, saving resources. It also offers tighter control over permissions, so extensions can't easily misuse them. MV3 has separate environments for content scripts, making data more secure. Also, MV3 prefers the declarativeNetRequest API over the old 'blocking' webRequest API. This change means extensions see less of a user's data, making browsing safer.

API Endpoints (Serverless Deployment on AWS Lambda)

Using Serverless, Flask APIs are deployed to AWS Lambda, ensuring scalability without the need for server maintenance.

Project Links

Merge Requests

The following merge requests were made to the project during GSoC 2023.

Social Street Smart API Repository
Social Street Smart Repository (Chrome Extension)

Future Scope

  • Could enhance extension credibility by implementing a content filtering mechanism with AI-driven credibility scoring, user feedback loop, transparency, and educational resources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment