Spaces:
Sleeping
Sleeping
gabrielaltay
commited on
Commit
•
d967c00
1
Parent(s):
b71991f
update
Browse files
app.py
CHANGED
@@ -1,5 +1,21 @@
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
st.set_page_config(layout="wide", page_title="LegisQA")
|
4 |
|
5 |
st.write("hello")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_openai import ChatOpenAI
|
2 |
+
from langchain_core.messages import HumanMessage, SystemMessage
|
3 |
+
|
4 |
import streamlit as st
|
5 |
|
6 |
st.set_page_config(layout="wide", page_title="LegisQA")
|
7 |
|
8 |
st.write("hello")
|
9 |
+
llm = ChatOpenAI(
|
10 |
+
openai_api_key=st.secrets["openai_api_key"]
|
11 |
+
)
|
12 |
+
|
13 |
+
messages = [
|
14 |
+
SystemMessage(
|
15 |
+
content="You are a helpful assistant that translates English to French."
|
16 |
+
),
|
17 |
+
HumanMessage(
|
18 |
+
content="Translate this sentence from English to French. I love programming."
|
19 |
+
),
|
20 |
+
]
|
21 |
+
st.write(llm.invoke(messages))
|