fixed a rephrase problem

This commit is contained in:
tcsenpai 2024-12-25 18:36:35 +01:00
parent 7c99592fe0
commit baa906c11a

View File

@ -160,6 +160,10 @@ st.markdown(
if "messages" not in st.session_state:
st.session_state.messages = []
# Initialize session state for rephrased transcript if not exists
if "rephrased_transcript" not in st.session_state:
st.session_state.rephrased_transcript = None
# Create a single header container
header = st.container()
@ -418,8 +422,9 @@ def main():
with st.spinner("Rephrasing transcript..."):
ollama_client = OllamaClient(ollama_url, selected_model)
prompt = f"Rephrase the following transcript to make it more readable and well-formatted, keeping the main content intact:\n\n{summary['transcript']}"
rephrased = ollama_client.generate(prompt)
st.markdown(rephrased)
st.session_state.rephrased_transcript = ollama_client.generate(
prompt
)
if st.button("📋 Share"):
try:
@ -448,6 +453,10 @@ URL: {video_url}
st.subheader("📊 AI Summary")
st.markdown(summary["summary"])
# After the rephrase button, add:
if st.session_state.rephrased_transcript:
st.markdown(st.session_state.rephrased_transcript)
if __name__ == "__main__":
main()