mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Add missing Audio model
This commit is contained in:
parent
c79635aaeb
commit
eb05b87882
1 changed files with 9 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import base64
|
||||
from typing import Union, Dict, List, Optional
|
||||
from abc import abstractmethod
|
||||
from urllib.parse import quote_plus, unquote_plus
|
||||
|
|
@ -228,6 +229,14 @@ class Sources(ResponseType):
|
|||
for idx, link in enumerate(self.list)
|
||||
]))
|
||||
|
||||
class Audio(HiddenResponse):
|
||||
def __init__(self, data: bytes) -> None:
|
||||
self.data = data
|
||||
|
||||
def to_string(self) -> str:
|
||||
data_base64 = base64.b64encode(self.data).decode()
|
||||
return f"data:audio/mpeg;base64,{data_base64}"
|
||||
|
||||
class YouTube(ResponseType):
|
||||
def __init__(self, ids: List[str]) -> None:
|
||||
"""Initialize with a list of YouTube IDs."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue