File size: 882 Bytes
20722c2
e801825
 
 
20722c2
2701462
20722c2
 
 
 
e801825
20722c2
e801825
20722c2
e801825
20722c2
e801825
20722c2
e801825
2701462
 
e801825
 
20722c2
2701462
20722c2
e801825
20722c2
e801825
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
from langchain import OpenAI
from langchain.chains import LLMChain
from langchain.prompts import ChatPromptTemplate
import os 
from langchain_openai import ChatOpenAI

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


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

options = ["English", "Telugu", "Hindi", "French", "German", "Russian", "Spanish"]

input_language = st.selectbox("Input Language: ", options)

text = st.text_area("Text Input: ")

if st.button("Submit"):
    
    llm = ChatOpenAI(model = "gpt-3.5-turbo",temperature = 0)
    prompt = ChatPromptTemplate.from_messages([("system", "You are an expert summarizer for {lang} texts."),
                                               ("human", "{text}")])

    chain = prompt|llm

    response = chain.run({"lang": input_language, "text": text})

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