Spaces:
Sleeping
Sleeping
import streamlit as st | |
import os | |
# Function to read the counter | |
def read_counter(): | |
if os.path.exists("counter.txt"): | |
with open("counter.txt", "r") as f: | |
return int(f.read()) | |
else: | |
return 0 | |
# Function to update the counter | |
def update_counter(): | |
current_count = read_counter() + 1 | |
with open("counter.txt", "w") as f: | |
f.write(str(current_count)) | |
return current_count | |
# Streamlit UI | |
st.title("Contract Analysis App") | |
# Display current usage count | |
current_count = read_counter() | |
st.write(f"App has been used **{current_count}** times.") | |
# Button to analyze contract | |
if st.button("Analyze Contract"): | |
new_count = update_counter() | |
st.success(f"Contract analyzed! Total app usage: {new_count}") | |