-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit_app.py
More file actions
64 lines (47 loc) · 1.47 KB
/
streamlit_app.py
File metadata and controls
64 lines (47 loc) · 1.47 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import streamlit as st
import requests
API = "https://smart-legal-document-manager-production.up.railway.app"
st.title("Smart Legal Document Manager")
menu = st.sidebar.selectbox(
"Choose Action",
["Create Document", "Update Document", "Compare Versions"]
)
if menu == "Create Document":
st.header("Create Document")
title = st.text_input("Title")
content = st.text_area("Content")
user = st.text_input("User")
if st.button("Create"):
res = requests.post(
f"{API}/documents/",
json={
"title": title,
"content": content,
"user": user
}
)
st.json(res.json())
elif menu == "Update Document":
st.header("Update Document")
doc_id = st.number_input("Document ID", step=1)
content = st.text_area("New Content")
user = st.text_input("User")
if st.button("Update"):
res = requests.put(
f"{API}/documents/{doc_id}",
json={
"content": content,
"user": user
}
)
st.json(res.json())
elif menu == "Compare Versions":
st.header("Compare Versions")
doc_id = st.number_input("Document ID", step=1)
v1 = st.number_input("Version 1", step=1)
v2 = st.number_input("Version 2", step=1)
if st.button("Compare"):
res = requests.get(
f"{API}/documents/{doc_id}/compare?v1={v1}&v2={v2}"
)
st.json(res.json())