Sachitksh's picture
Update app.py
a91ceef verified
Raw
History Blame Contribute Delete
933 Bytes
import streamlit as st
from langchain_google_genai import ChatGoogleGenerativeAI
st.title("Text Summarizer")
def generate_summary(text):
prompt = f"Generate workable scenes from the following script: {script}"
llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["API_KEY"])
summary = llm.invoke(prompt)
summary = summary.content
return summary
with st.form("text_summarizer_form"):
script = st.text_area("Enter the script or screenplay")
submitted = st.form_submit_button("Generate Scenes")
if submitted and script:
scenes = generate_summary(script)
st.subheader("Generated Scenes:")
st.write(scenes)
elif submitted and not script:
st.error("Please enter a script to generate scenes.")
if st.button("Need Inspiration?"):
st.write("Breaking down a script into scenes can help visualize the flow of the story better. Try it out!")