GithubHelp home page GithubHelp logo

nn_models's Introduction

nn_models API

This is a RESTful API built with FastAPI for a Neural network.

Installation

  1. Clone the repository:
git clone https://github.com/your-username/social-media-api.git


2. Install the required dependencies:

```bash
pip install -r requirements.txt
  1. Start the server:
uvicorn main:app --reload

The API will be available at http://localhost:8000.

Endpoints

User Management

Register a new user

  • Method: POST
  • Path: /users/
  • Description: Register a new user in the system.
  • Request Body: A User object with username, email, and password fields.
  • Response: The created User object without the password.

Get a user by ID

  • Method: GET
  • Path: /users/{user_id}
  • Description: Retrieve information about a user by their ID.
  • Path Parameter: user_id - The ID of the user.
  • Response: The User object without the password.

Post Management

Create a new post

  • Method: POST
  • Path: /posts/
  • Description: Create a new post.
  • Request Body: A Post object with user_id, text, and optional media fields.
  • Response: The created Post object.

Get a post by ID

  • Method: GET
  • Path: /posts/{post_id}
  • Description: Retrieve a post by its ID.
  • Path Parameter: post_id - The ID of the post.
  • Response: The Post object.

Like a post

  • Method: POST
  • Path: /posts/{post_id}/like
  • Description: Like a post.
  • Path Parameter: post_id - The ID of the post.
  • Request Body: A User object with the user_id field.
  • Response: The updated Post object.

Comment on a post

  • Method: POST
  • Path: /posts/{post_id}/comment
  • Description: Comment on a post.
  • Path Parameter: post_id - The ID of the post.
  • Request Body: A Comment object with user_id and text fields.
  • Response: The updated Post object.

Repost a post

  • Method: POST
  • Path: /posts/{post_id}/repost
  • Description: Repost a post.
  • Path Parameter: post_id - The ID of the post.
  • Request Body: A User object with the user_id field.
  • Response: The updated Post object.

Data Models

User

class User(BaseModel):
    id: Optional[str] = None
    username: str
    email: str
    password: str
    created_at: Optional[datetime] = None

Post

class Post(BaseModel):
    id: Optional[str] = None
    user_id: str
    text: str
    media: List[str] = []
    likes: List[str] = []
    comments: List[dict] = []
    reposts: int = 0
    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None

Comment

class Comment(BaseModel):
    user_id: str
    text: str
    created_at: Optional[datetime] = None

nn_models's People

Contributors

hallexz avatar

Stargazers

Shi3ofreniR avatar  avatar

Watchers

 avatar

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.