Git Product home page Git Product logo

query_views_tv's Introduction

TV Data Show FastAPI Project

This project is a FastAPI application for managing and analyzing TV show data. The application supports uploading data, analyzing it, clustering, classification, and more.

Project Structure

tv_data_show/
├── controllers/
│   ├── v1/
│   │   ├── init.py
│   │   ├── analyze.py
│   │   ├── query.py
│   │   ├── upload.py
│   ├── init.py
├── core/
│   ├── init.py
│   ├── config.py
│   ├── security.py
├── db/
│   ├── init.py
│   ├── base.py
│   ├── models.py
│   ├── schemas.py
│   ├── session.py
├── services/
│   ├── init.py
│   ├── analyze.py
│   ├── upload.py
│   ├── query.py
├── globals.py
├── main.py
├── generate_api_key.py
├── interview_data.db
├── test.db
├── requirements.txt
├── Dockerfile
├── .env
└── tests/
    ├── init.py
    ├── conftest.py
    ├── test_main.py
    ├── test_analyze.py
    ├── test_query.py
    ├── test_upload.py

Setup and Installation

Prerequisites

  • Docker
  • Python 3.11
  • pip

Environment Variables

Create a .env file in the root of your project with the following content:

API_KEY=your_api_key_here

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/tv_data_show.git
    cd tv_data_show
  2. Install dependencies:

    pip install -r requirements.txt
  3. Generate an API key:

    You can generate an API key manually and place it in the .env file or use the provided script:

    python generate_api_key.py

    This will create an api_key.txt file. Move the API key from api_key.txt to your .env file.

Running the Application

Using Docker

  1. Build the Docker image:

    docker build -t tv_data_show:latest .
  2. Run the Docker container:

    docker run -p 8000:8000 --env-file .env tv_data_show:latest

Using Python

  1. Run the application:

    uvicorn main:app --reload

Project Functionality

Uploading Data

Endpoint: /api/v1/uploadfile/

  • Method: POST

  • Description: Upload a CSV file containing TV show data.

  • Example:

    curl -X POST "http://127.0.0.1:8000/api/v1/uploadfile/" -F "file=@path_to_your_file.csv" -H "Authorization: your_api_key"

Analyzing Data

Endpoint: /api/v1/analyze/

  • Method: POST

  • Description: Analyze the uploaded data.

  • Example:

    curl -X POST "http://127.0.0.1:8000/api/v1/analyze/" -H "Authorization: your_api_key"

Fetching Results

Endpoint: /api/v1/results/

  • Method: GET

  • Description: Fetch the analysis results.

  • Example:

    curl -X GET "http://127.0.0.1:8000/api/v1/results/" -H "Authorization: your_api_key"

Computing Similarity

Endpoint: /api/v1/similarity/

  • Method: GET

  • Description: Compute the similarity of a given video ID with other videos.

  • Example:

    curl -X GET "http://127.0.0.1:8000/api/v1/similarity/?video_id=YourVideoID" -H "Authorization: your_api_key"

Clustering Videos

Endpoint: /api/v1/cluster/

  • Method: GET

  • Description: Cluster the videos into a specified number of clusters.

  • Example:

    curl -X GET "http://127.0.0.1:8000/api/v1/cluster/?n_clusters=5" -H "Authorization: your_api_key"

Classifying Videos

Endpoint: /api/v1/classify/

  • Method: GET

  • Description: Classify the videos based on their features.

  • Example:

    curl -X GET "http://127.0.0.1:8000/api/v1/classify/" -H "Authorization: your_api_key"

Testing

Running Tests

  1. Install test dependencies:

    pip install pytest httpx python-dotenv
  2. Run the tests:

    pytest

Test Files

  • tests/conftest.py: Sets up environment variables for tests.
  • tests/test_main.py: Tests the main endpoints.
  • tests/test_analyze.py: Tests the analyze functionality.
  • tests/test_query.py: Tests the query functionality.
  • tests/test_upload.py: Tests the upload functionality.

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.