YingxuHe's picture
add mic button
cf9d671
raw
history blame
1.54 kB
import copy
import streamlit as st
from src.tunnel import start_server
from src.generation import FIXED_GENERATION_CONFIG, load_model
from src.pages import DEFAULT_DIALOGUE_STATES, sidebar_fragment, specify_audio_fragment, conversation_section
st.set_page_config(page_title='MERaLiON-AudioLLM', page_icon = "🔥", layout='wide')
st.markdown('<style>' + open('./style/app_style.css').read() + '</style>', unsafe_allow_html=True)
if "server" not in st.session_state:
st.session_state.server = start_server()
if "client" not in st.session_state or 'model_name' not in st.session_state:
st.session_state.client, st.session_state.model_name = load_model()
for key, value in FIXED_GENERATION_CONFIG.items():
if key not in st.session_state:
st.session_state[key]=copy.deepcopy(value)
for key, value in DEFAULT_DIALOGUE_STATES.items():
if key not in st.session_state:
st.session_state[key]=copy.deepcopy(value)
with st.sidebar:
sidebar_fragment()
if st.sidebar.button('Clear History'):
st.session_state.update(copy.deepcopy(DEFAULT_DIALOGUE_STATES))
st.markdown("<h1 style='text-align: center;'>MERaLiON-AudioLLM Demo 🤖</h1>", unsafe_allow_html=True)
st.markdown(
"""This demo is based on [MERaLiON-AudioLLM](https://huggingface.co/MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION),
developed by I2R, A*STAR, in collaboration with AISG, Singapore.
It is tailored for Singapore’s multilingual and multicultural landscape."""
)
specify_audio_fragment()
conversation_section()