Commit
•
8963649
1
Parent(s):
71c7123
First commit
Browse files- README.md +3 -4
- app.py +35 -0
- requirements.txt +1 -0
README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
---
|
2 |
title: Law
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.36.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
-
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: Law
|
3 |
+
emoji: ⚖️
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: purple
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.36.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
|
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
st.title("⚖️ Legal Assistant (WIP)")
|
4 |
+
|
5 |
+
# client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
|
6 |
+
|
7 |
+
if "openai_model" not in st.session_state:
|
8 |
+
st.session_state["openai_model"] = "gpt-3.5-turbo"
|
9 |
+
|
10 |
+
if "messages" not in st.session_state:
|
11 |
+
st.session_state.messages = []
|
12 |
+
|
13 |
+
for message in st.session_state.messages:
|
14 |
+
with st.chat_message(message["role"]):
|
15 |
+
st.markdown(message["content"])
|
16 |
+
|
17 |
+
if prompt := st.chat_input("What is up?"):
|
18 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
19 |
+
with st.chat_message("user"):
|
20 |
+
st.markdown(prompt)
|
21 |
+
|
22 |
+
with st.chat_message("assistant"):
|
23 |
+
# stream = client.chat.completions.create(
|
24 |
+
# model=st.session_state["openai_model"],
|
25 |
+
# messages=[
|
26 |
+
# {"role": m["role"], "content": m["content"]}
|
27 |
+
# for m in st.session_state.messages
|
28 |
+
# ],
|
29 |
+
# stream=True,
|
30 |
+
# )
|
31 |
+
# response = st.write_stream(stream)
|
32 |
+
st.write(prompt)
|
33 |
+
response = prompt
|
34 |
+
st.session_state.messages.append(
|
35 |
+
{"role": "assistant", "content": response})
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
streamlit==1.36.0
|