mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-14 17:13:25 +00:00
feat: text to audio
This commit is contained in:
@ -2,20 +2,37 @@ from abc import ABC, abstractmethod
|
||||
|
||||
from fastapi import Request, Response
|
||||
|
||||
|
||||
class Blackbox(ABC):
|
||||
|
||||
"""Blackbox class that provides a standard way to create an blackbox class using
|
||||
inheritance. All blackbox classes should inherit from this class and implement
|
||||
the methods processing, valid and fast_api_handler.
|
||||
If implemented correctly, the blackbox class can be used in the main.py file
|
||||
"""
|
||||
def __init__(self, config: any) -> None:
|
||||
pass
|
||||
|
||||
"""
|
||||
processing method should return the processed data. The data is passed as an argument
|
||||
to the method. All processing shouldn't interaction with the disk
|
||||
but dist / list / string / bytes / io.BytesIO or other data type that in memory.
|
||||
Output same as above.
|
||||
"""
|
||||
@abstractmethod
|
||||
def processing(self, data: any):
|
||||
async def processing(self, data: any) -> any:
|
||||
pass
|
||||
|
||||
"""
|
||||
valid method should return True if the data is valid and False if the data is invalid
|
||||
"""
|
||||
@abstractmethod
|
||||
def valid(self, data: any) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
"""
|
||||
fast_api_handler method should return a fastapi Response object. This method is used
|
||||
to handle the request from the fastapi server. The request object is passed as an argument
|
||||
to the method.
|
||||
"""
|
||||
@abstractmethod
|
||||
def fast_api_handler(self, request: Request) -> Response:
|
||||
pass
|
||||
Reference in New Issue
Block a user