Spaces:
Sleeping
Sleeping
| from langchain_openai import ChatOpenAI | |
| from langchain_core.prompts import ChatPromptTemplate | |
| import streamlit as st | |
| import os | |
| openai_api_k = os.getenv("openai_api") | |
| llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo",openai_api_key=openai_api_k,max_tokens=150) | |
| prompt = ChatPromptTemplate.from_messages([ | |
| ("system", "You are so good in writing emails.You are a helpful assistant that gives a reply email for a particular email"), | |
| ("human", "give a neat and proper reply email\n{input}") | |
| ]) | |
| st.title("Email Reply Generator") | |
| st.write("Enter the email text you want a reply for:") | |
| email_input = st.text_area("Email Text") | |
| if st.button("Generate Reply"): | |
| chain = prompt | llm | |
| response = chain.invoke({"input": email_input}) | |
| st.write("Generated Email Reply:") | |
| st.write(response.content) |