styleMode plainContainer 1 [icon: docker, color: blue] {ML Models [icon: machine-learning] { Conetnt Type Predictor [icon: machine-learning] Channel Recommender System [icon: machine-learning]}ML Models API [icon: fastapi, color: green]}YouTube Data v3 API [icon: youtube, color: red]Container 2 [icon: docker, color: blue] {MongoDB [icon: mongodb, color: green] { Video Details [icon: database] Channel Details [icon: database]}Backend API [icon: fastapi, color: green]}Container 3 [icon: docker, color: blue] {Frontend [icon: streamlit, color: red]}User [icon: user]User > Container 3Container 3 > Backend API, ML Models APIBackend API > MongoDBBackend API > YouTube Data v3 APIML Models API > ML Models
Frontend and Backend API Interaction
What happens when user upload their watch-history.json data to see analysis?
More and better data retrieval for analysis.
Use of YouTube Data v3 API to fetch more details of watched videos.
sequenceDiagram
participant Frontend as Frontend
participant API as API
participant ChannelDetails as ChannelDetails
participant VideoDetails as VideoDetails
Frontend ->> API: Request all IDs from User's watch history
Note over Frontend, API: User's watch history IDs
activate Frontend
API ->> ChannelDetails: Exclude IDs already available in DB
ChannelDetails -->> API: IDs not in Database
API -->> Frontend: Filtered IDs
deactivate Frontend
Note over Frontend, API: Filtered IDs
Frontend ->> API: Fetch video details of filtered IDs
Note over Frontend, API: Video details request
activate API
API ->> VideoDetails: Store fetched details
VideoDetails -->> API: Stored!
API ->> ChannelDetails: Store channel's videos ID from fetched data
ChannelDetails -->> API: Stored!
API -->> Frontend: Video Details
deactivate API
Note over Frontend: Show graphs using fetched data
Code for Diagram
styleMode plainFrontend [icon: streamlit, color: red]API [icon: fastapi, color: green]ChannelDetails [icon: mongodb, color: purple, label: Channel Videos ID DB]VideoDeatils [icon: mongodb, color: orange, label: Video Details DB]Frontend > API: All IDs from User's watch historyactivate FrontendAPI > ChannelDetails: Exclude IDs already available in DBChannelDetails > API: IDs not in DatabaseAPI > Frontend: Filtered IDsdeactivate FrontendFrontend > API: Fetch video details of filtered IDsactivate APIAPI > VideoDeatils: Store fetched detailsVideoDeatils > API : Stored!API > ChannelDetails: Store channel's videos ID from fetched dataChannelDetails > API : Stored!API > Frontend: Video Detailsdeactivate API
ML Model Working
How does ML Model inference through API?
How to train ML Model on my custom data?
Code for Diagram
direction rightstyleMode plainuser [icon: user, shape: diamond, label: User]inputData [icon: data, shape: cylinder, label: Input Data]model [icon: machine-learning, shape: document, label: ML Model]mlApi [icon: fastapi, label: ML API]modelOnWeb [icon: globe, shape: oval, label: Model On Web]prediction [icon: graph, label: Model Prediction]user > inputDatainputData > mlApimlApi > model: ExistsmlApi > modelOnWeb: Not ExistsmodelOnWeb > model: Download and Storemodel > predictionprediction > user
User Data Flow
Data manipulation after user uploads their data on application.
Use of YouTube Data v3 API to fetch more details about watched videos.
Leveraging the power of Python libraries like Polars for data manipulation. We can use Pandas also.