Spaces:
Sleeping
Sleeping
File size: 782 Bytes
76f5c58 83c03fb 76f5c58 9630547 76f5c58 |
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 |
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"):
response = chain.invoke({"input": user_input})
st.write("Generated Reply:")
st.write(response.content) |