File size: 659 Bytes
20722c2
2701462
bd3f7cf
 
20722c2
52d055e
20722c2
e801825
20722c2
bd3f7cf
20722c2
e801825
bd3f7cf
 
 
20722c2
bd3f7cf
20722c2
bd3f7cf
20722c2
e801825
bd3f7cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
import os 

os.environ["OPENAI_API_KEY"] = os.getenv("k2")

st.title("Summarization Application :robot_face:")

text = st.text_area("Text Input: ", height=200)

if st.button("Submit"):
    llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
    prompt = ChatPromptTemplate.from_messages([("system", "You are a good assistant for summarization."),
                                               ("human", "{i}")])

    chain = prompt | llm

    response = chain.invoke({"i": text})

    st.write("Summary: ")
    st.write(response.content)