Summary
Hello community!
I have a Streamlit application where I use two forms, one in each column. The first form transcribes an audio file using Wav2Vec2, and the second one asks questions about the transcription using ChatGPT. The problem Iām facing is that when I click the āchatgpt_submit_buttonā, it also triggers the ātranscribe_submit_buttonā. I need them to be separated, so that each column operates independently.
Hereās a simplified version of my code:
Code snippet:
import streamlit as st
st.set_page_config(page_title="Speech-to-Text Transcription & ChatGPT", layout="wide", page_icon="š¤")
c1, c2 = st.columns([1, 1], gap="medium")
with c1:
st.header("Transcribe your audio")
with st.form("transcribe_form"):
f = st.file_uploader("", type=[".wav"])
transcribe_submit_button = st.form_submit_button("Transcribe")
if f and transcribe_submit_button is not None:
# Transcription code here
pass
with c2:
st.header("Ask ChatGPT about the transcription")
with st.form("chatgpt_form"):
prompt = st.text_area("Enter your query:", "", height=200)
chatgpt_submit_button = st.form_submit_button("Generate response")
if chatgpt_submit_button:
# ChatGPT code here
pass
I want the ātranscribe_submit_buttonā and āchatgpt_submit_buttonā to work independently of each other. How can I achieve this in Streamlit? Any help would be greatly appreciated.
Thank you!