Spaces:
Sleeping
Sleeping
Download app.py from saqib1915/DigitalCaseDiary: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/saqib1915/DigitalCaseDiary/resolve/main/app.py
- Command line
-
hf download hf://spaces/saqib1915/DigitalCaseDiary/app.py
-
curl -L -o app.py https://huggingface.co/spaces/saqib1915/DigitalCaseDiary/resolve/main/app.py
1.51 kB
| import streamlit as st | |
| import pandas as pd | |
| from plotly import express as px | |
| # Title for the app | |
| st.title("Lawyer's Digital Diary") | |
| # Sidebar for adding new cases | |
| st.sidebar.header("Add New Case") | |
| # Inputs for the case details | |
| case_title = st.sidebar.text_input("Case Title") | |
| judge_name = st.sidebar.text_input("Judge Name") | |
| last_date = st.sidebar.date_input("Last Date") | |
| next_date = st.sidebar.date_input("Next Date") | |
| proceedings = st.sidebar.text_area("Case Proceedings") | |
| # Placeholder for cases | |
| if "cases" not in st.session_state: | |
| st.session_state["cases"] = [] | |
| # Add new case button | |
| if st.sidebar.button("Add Case"): | |
| new_case = { | |
| "Case Title": case_title, | |
| "Judge Name": judge_name, | |
| "Last Date": last_date, | |
| "Next Date": next_date, | |
| "Proceedings": proceedings | |
| } | |
| st.session_state["cases"].append(new_case) | |
| st.sidebar.success("Case added successfully!") | |
| # Display case details | |
| st.header("Case Details") | |
| if st.session_state["cases"]: | |
| cases_df = pd.DataFrame(st.session_state["cases"]) | |
| st.dataframe(cases_df) | |
| # Option to visualize data | |
| st.subheader("Visualize Case Dates") | |
| if st.button("Show Timeline"): | |
| fig = px.timeline( | |
| cases_df, | |
| x_start="Last Date", | |
| x_end="Next Date", | |
| y="Case Title", | |
| title="Case Timelines", | |
| labels={"y": "Case Title"} | |
| ) | |
| st.plotly_chart(fig) | |
| else: | |
| st.info("No cases added yet. Use the sidebar to add cases.") | |