-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render waveform in a different context (#10)
* add firestore_sdk ad session_manager * save user chats on firestore * pass down session_id for a deterministic workflow * handle conversion of chat object to/fro a dict * remove references to langchain * reuse a previously downloaded audiofile if it's processable * render audiocast metdata on share page * cleanup * temp remove audio_enchancement * sanitize audiocast transcript * add elevenlabs client * add __text_to_speech_elevenlabs; cleanup * use dry in text_to_speech * only lint on python versions 3.11 and 3.12 * add write permission to deploy job for marocchino/sticky-pull-request-comment * use eleven_multilingual_v2 model for improved stability, accuracy and quality * Refactor audiocast page to include waveform visualization * put waveform viz in an expander * cleanup * move download_waveform_video internal to render_waveform * allow toggling waveform visualizer * save waveform to gcs * reshuffle dependencies in requirements.txt * add pycairo to deps * add a server app * add header and process_time middlewares * make utils a shared folder * use root level services in app dir * write an improved init_project workflow * move streamlit related packages into app folder * convert app.src.utils into a module * install setup tools and create a setup file for utils_pkg * remove streamlit content from chat_utils * cleanup remnants * more cleanup * update package imports and initialization logic for utils_pkg * hit the backend in for chat workflow in generate_stream_response * add generate_audiocast endpoint handler * create a handler for get_audiocast by session_id * abstract waveform_utils; save wave_form on_generate audiocast * hit the server for generate_audiocast and get_audiocast * abstract audiocast inteface definitions * move audiocast_request to server * remove unused artifacts * save and update metadata.info * Remove audiocast page and add docstrings to session manager methods * revise github actions workflow files * add deploy_server.yml * rename deploy server workflow to reflect server deployment * upgrade to the latest version of pip * cleanup * remove the underscore in the service name * remove unused env variables * cleanup * add dockerfile for deploying the server * populate a dockerignore file on the fly * remove unused context from gcloudignore * localize the .*ignore files * move the dockerfile to root project pre-deploy step * specify corret path to streamlit index * Add debug output for Docker and gcloud ignore files; set no_traffic to false for deployment * add a gunicorn config file * rename server to api * rename all footprints of server to api * refactor: update workflow names and paths for cloudrun deployment * bump version to 1.0.1 and update project description * move chat_request to api utils * move api only utils into api folder * rename utils_pkg to shared_utils_pkg * add pre-commit config * refactor: clean up sidebar and improve metadata subscription handling * feat: add Streamlit configuration for browser and client settings * log the project_id in init_admin_sdk * remove reference_code from .gitignore * allow other ui elements to render before loading waveform video * remove subscription to metadata.info
- Loading branch information
1 parent
ca62856
commit 9c31b5c
Showing
6 changed files
with
60 additions
and
42 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
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,29 +1,34 @@ | ||
from queue import Queue | ||
import asyncio | ||
|
||
import streamlit as st | ||
|
||
from shared_utils_pkg.session_manager import SessionManager | ||
|
||
|
||
def subscribe_to_audio_generation(session_id: str): | ||
"""Subscribe to audio generation metadata""" | ||
q = Queue() | ||
class SubscribeToAudioGeneration: | ||
def __init__(self, session_id: str): | ||
self.session_id = session_id | ||
self.info: str | None = None | ||
|
||
def handler(info: str | None): | ||
if info: | ||
q.put(info, block=False) | ||
def create(self): | ||
"""Subscribe to audio generation metadata""" | ||
|
||
db = SessionManager(session_id) | ||
doc_watch = db.subscribe_to_metadata_info(handler) | ||
def __handler(info: str): | ||
self.info = info | ||
|
||
with st.empty(): | ||
while True: | ||
try: | ||
info = q.get(timeout=2) | ||
if not info: | ||
break | ||
st.info(info) | ||
except Exception: | ||
break | ||
db = SessionManager(self.session_id) | ||
return db.subscribe_to_metadata_info(__handler) | ||
|
||
return doc_watch | ||
async def _update_ui(self, read_timeout=10): | ||
"""Update the UI with the current info attribute value.""" | ||
timeout = 0 | ||
container = st.empty() | ||
|
||
with container: | ||
while read_timeout > timeout: | ||
if self.info: | ||
container.info(self.info) | ||
await asyncio.sleep(1) | ||
timeout += 1 | ||
|
||
container.empty() |
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
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