mirror of
https://github.com/tcsenpai/youlama.git
synced 2025-06-07 03:35:41 +00:00
fixed a rephrase problem
This commit is contained in:
parent
7c99592fe0
commit
baa906c11a
13
src/main.py
13
src/main.py
@ -160,6 +160,10 @@ st.markdown(
|
|||||||
if "messages" not in st.session_state:
|
if "messages" not in st.session_state:
|
||||||
st.session_state.messages = []
|
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
|
# Create a single header container
|
||||||
header = st.container()
|
header = st.container()
|
||||||
|
|
||||||
@ -418,8 +422,9 @@ def main():
|
|||||||
with st.spinner("Rephrasing transcript..."):
|
with st.spinner("Rephrasing transcript..."):
|
||||||
ollama_client = OllamaClient(ollama_url, selected_model)
|
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']}"
|
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.session_state.rephrased_transcript = ollama_client.generate(
|
||||||
st.markdown(rephrased)
|
prompt
|
||||||
|
)
|
||||||
|
|
||||||
if st.button("📋 Share"):
|
if st.button("📋 Share"):
|
||||||
try:
|
try:
|
||||||
@ -448,6 +453,10 @@ URL: {video_url}
|
|||||||
st.subheader("📊 AI Summary")
|
st.subheader("📊 AI Summary")
|
||||||
st.markdown(summary["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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user