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 a helpful assistant that gives a reply email for a particular email"), | |
("human", "{input}") | |
]) | |
# Streamlit interface | |
st.title("Email Reply Generator") | |
st.write("Enter the email text you want a reply for:") | |
# User input | |
user_input = st.text_area("Email Text") | |
# Generate and display the response | |
if st.button("Generate Reply"): | |
chain = prompt | llm | |
response = chain.invoke({"input": user_input}) | |
st.write("Generated Reply:") | |
st.write(response.content) |