This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils.decorators import apply_defaults | |
import jwt | |
from operators.base_web3_custom_operator import BaseWeb3CustomOperator | |
from datetime import datetime, timedelta, timezone | |
class VerifyVoiceIdOperator(BaseWeb3CustomOperator): | |
""" | |
An operator to verify a user's voice ID using a Smart Contract on the Ethereum blockchain. | |
Inherits: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operators.base_custom_operator import BaseCustomOperator | |
from airflow.utils.decorators import apply_defaults | |
from qdrant_client import QdrantClient | |
class FindMostSimilarVoiceOperator(BaseCustomOperator): | |
""" | |
Custom Airflow operator to find the most similar voice based on audio embeddings. | |
This operator searches for the most similar voice in a given collection using audio embeddings | |
generated from an input audio file. It connects to a QDrant server to perform the search. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from airflow import DAG | |
import importlib | |
import os | |
# Define default arguments for the DAG | |
default_args = { | |
'owner': 'airflow', | |
'start_date': datetime(2023, 1, 1), | |
'retries': 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils.decorators import apply_defaults | |
from operators.base_custom_operator import BaseCustomOperator | |
import requests | |
class ProcessResultWebhookOperator(BaseCustomOperator): | |
""" | |
Executes a task to process and send result data to a specified webhook. | |
""" | |
@apply_defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operators.base_web3_custom_operator import BaseWeb3CustomOperator | |
from airflow.utils.decorators import apply_defaults | |
class ChangeVoiceIdVerificationStateOperator(BaseWeb3CustomOperator): | |
""" | |
Operator for changing the verification state of a voice ID in a blockchain smart contract. | |
Inherits from BaseWeb3CustomOperator. | |
Args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils.decorators import apply_defaults | |
import jwt | |
from operators.base_web3_custom_operator import BaseWeb3CustomOperator | |
from datetime import datetime, timedelta, timezone | |
class VerifyVoiceIdOperator(BaseWeb3CustomOperator): | |
""" | |
An operator to verify a user's voice ID using a Smart Contract on the Ethereum blockchain. | |
Inherits: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils.decorators import apply_defaults | |
from operators.base_web3_custom_operator import BaseWeb3CustomOperator | |
class RegisterVoiceIDOperator(BaseWeb3CustomOperator): | |
""" | |
Operator for registering a voice ID in a blockchain smart contract. | |
Inherits from BaseWeb3CustomOperator. | |
Args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operators.base_custom_operator import BaseCustomOperator | |
from airflow.utils.decorators import apply_defaults | |
from qdrant_client import QdrantClient | |
class FindMostSimilarVoiceOperator(BaseCustomOperator): | |
""" | |
Custom Airflow operator to find the most similar voice based on audio embeddings. | |
This operator searches for the most similar voice in a given collection using audio embeddings | |
generated from an input audio file. It connects to a QDrant server to perform the search. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils.decorators import apply_defaults | |
from operators.base_custom_operator import BaseCustomOperator | |
from qdrant_client import QdrantClient, http | |
class QDrantEmbeddingsOperator(BaseCustomOperator): | |
""" | |
Custom Apache Airflow operator for upserting voice embeddings into the QDrant vector database. | |
:param qdrant_uri: The URI of the QDrant service. | |
:type qdrant_uri: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from resemblyzer import preprocess_wav, VoiceEncoder | |
from airflow.utils.decorators import apply_defaults | |
from operators.base_custom_operator import BaseCustomOperator | |
class GenerateVoiceEmbeddingsOperator(BaseCustomOperator): | |
""" | |
Custom Airflow operator to generate voice embeddings from audio files. | |
This operator preprocesses an audio file, generates embeddings from the audio data, | |
and logs the execution details to MongoDB. |
NewerOlder