-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b715fc
commit 795b453
Showing
7 changed files
with
149 additions
and
86 deletions.
There are no files selected for viewing
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
Binary file not shown.
89 changes: 89 additions & 0 deletions
89
openduck-py/openduck_py/alembic/versions/42f7dfcde186_add_chat_history.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
"""add_chat_history | ||
Revision ID: 42f7dfcde186 | ||
Revises: 00cad591e71a | ||
Create Date: 2024-02-20 20:16:43.082215+00:00 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import sqlite | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '42f7dfcde186' | ||
down_revision: Union[str, None] = '00cad591e71a' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('chat_history', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=True), | ||
sa.Column('session_id', sa.Text(), nullable=False), | ||
sa.Column('history_json', sqlite.JSON(), nullable=True), | ||
sa.Column('created_at', sa.DateTime(), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index(op.f('ix_chat_history_user_id'), 'chat_history', ['user_id'], unique=False) | ||
op.create_table('template_deployment', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.Text(), nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('url_name', sa.String(), nullable=False), | ||
sa.Column('display_name', sa.String(), nullable=True), | ||
sa.Column('prompt', sqlite.JSON(), nullable=True), | ||
sa.Column('created_at', sa.DateTime(), nullable=False), | ||
sa.Column('deleted_at', sa.DateTime(), nullable=True), | ||
sa.Column('meta_json', sqlite.JSON(), nullable=True), | ||
sa.Column('model', sa.String(), nullable=True), | ||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('uuid') | ||
) | ||
op.create_index('deployment_user_id_url_name_unique_not_deleted', 'template_deployment', ['user_id', 'url_name'], unique=True, sqlite_where=sa.text('deleted_at IS NULL')) | ||
op.create_index(op.f('ix_template_deployment_id'), 'template_deployment', ['id'], unique=False) | ||
op.create_index(op.f('ix_template_deployment_url_name'), 'template_deployment', ['url_name'], unique=False) | ||
op.create_index(op.f('ix_template_deployment_user_id'), 'template_deployment', ['user_id'], unique=False) | ||
op.create_table('template_prompt', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.Text(), nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('url_name', sa.String(), nullable=False), | ||
sa.Column('display_name', sa.String(), nullable=True), | ||
sa.Column('prompt', sqlite.JSON(), nullable=True), | ||
sa.Column('created_at', sa.DateTime(), nullable=False), | ||
sa.Column('deleted_at', sa.DateTime(), nullable=True), | ||
sa.Column('meta_json', sqlite.JSON(), nullable=True), | ||
sa.Column('model', sa.String(), nullable=True), | ||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index(op.f('ix_template_prompt_id'), 'template_prompt', ['id'], unique=False) | ||
op.create_index(op.f('ix_template_prompt_url_name'), 'template_prompt', ['url_name'], unique=False) | ||
op.create_index(op.f('ix_template_prompt_user_id'), 'template_prompt', ['user_id'], unique=False) | ||
op.create_index(op.f('ix_template_prompt_uuid'), 'template_prompt', ['uuid'], unique=True) | ||
op.create_index('prompt_user_id_url_name_unique_not_deleted', 'template_prompt', ['user_id', 'url_name'], unique=True, sqlite_where=sa.text('deleted_at IS NULL')) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index('prompt_user_id_url_name_unique_not_deleted', table_name='template_prompt', sqlite_where=sa.text('deleted_at IS NULL')) | ||
op.drop_index(op.f('ix_template_prompt_uuid'), table_name='template_prompt') | ||
op.drop_index(op.f('ix_template_prompt_user_id'), table_name='template_prompt') | ||
op.drop_index(op.f('ix_template_prompt_url_name'), table_name='template_prompt') | ||
op.drop_index(op.f('ix_template_prompt_id'), table_name='template_prompt') | ||
op.drop_table('template_prompt') | ||
op.drop_index(op.f('ix_template_deployment_user_id'), table_name='template_deployment') | ||
op.drop_index(op.f('ix_template_deployment_url_name'), table_name='template_deployment') | ||
op.drop_index(op.f('ix_template_deployment_id'), table_name='template_deployment') | ||
op.drop_index('deployment_user_id_url_name_unique_not_deleted', table_name='template_deployment', sqlite_where=sa.text('deleted_at IS NULL')) | ||
op.drop_table('template_deployment') | ||
op.drop_index(op.f('ix_chat_history_user_id'), table_name='chat_history') | ||
op.drop_table('chat_history') | ||
# ### end Alembic commands ### |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
import soundfile as sf | ||
from openduck_py.voices import styletts2 | ||
from openduck_py.voices.settings import SAMPLE_RATE | ||
|
||
|
||
styletts2.styletts2_inference( | ||
text="Hello, my name is Matthew. How are you today?", | ||
model_path="styletts2/rap_v1.pt", | ||
model_bucket="uberduck-models-us-west-2", | ||
config_path="styletts2/rap_v1_config.yml", | ||
config_bucket="uberduck-models-us-west-2", | ||
output_bucket="uberduck-audio-outputs", | ||
output_path="test.wav", | ||
style_prompt_path="511f17d1-8a30-4be8-86aa-4cdd8b0aed70.wav", | ||
style_prompt_bucket="uberduck-audio-files", | ||
audio = styletts2.styletts2_inference( | ||
text="Hey, I'm the Uberduck! What do you want to learn about today?" | ||
) | ||
|
||
sf.write("startup.wav", audio, SAMPLE_RATE) # Assuming the sample rate is 22050 Hz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
alembic | ||
aiosqlite | ||
aioboto3 | ||
asgiref | ||
asyncpg | ||
azure-cognitiveservices-speech | ||
databases | ||
|