Spaces:
Sleeping
Sleeping
venkat charan
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_openai import ChatOpenAI
|
2 |
+
from langchain_core.prompts import ChatPromptTemplate
|
3 |
+
import streamlit as st
|
4 |
+
import os
|
5 |
+
|
6 |
+
openai_api_k = os.getenv("openai_key")
|
7 |
+
|
8 |
+
llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo",openai_api_key=openai_api_k)
|
9 |
+
prompt = ChatPromptTemplate.from_messages([
|
10 |
+
("system", "You are a helpful assistant that gives a reply email for a particular email"),
|
11 |
+
("human", "{input}")
|
12 |
+
])
|
13 |
+
|
14 |
+
# Streamlit interface
|
15 |
+
st.title("Email Reply Generator")
|
16 |
+
st.write("Enter the email text you want a reply for:")
|
17 |
+
|
18 |
+
# User input
|
19 |
+
user_input = st.text_area("Email Text")
|
20 |
+
|
21 |
+
# Generate and display the response
|
22 |
+
if st.button("Generate Reply"):
|
23 |
+
response = chain.invoke({"input": user_input})
|
24 |
+
st.write("Generated Reply:")
|
25 |
+
st.write(response.content)
|