Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
|
4 |
+
# Function to read the counter
|
5 |
+
def read_counter():
|
6 |
+
if os.path.exists("counter.txt"):
|
7 |
+
with open("counter.txt", "r") as f:
|
8 |
+
return int(f.read())
|
9 |
+
else:
|
10 |
+
return 0
|
11 |
+
|
12 |
+
# Function to update the counter
|
13 |
+
def update_counter():
|
14 |
+
current_count = read_counter() + 1
|
15 |
+
with open("counter.txt", "w") as f:
|
16 |
+
f.write(str(current_count))
|
17 |
+
return current_count
|
18 |
+
|
19 |
+
# Streamlit UI
|
20 |
+
st.title("Contract Analysis App")
|
21 |
+
|
22 |
+
# Display current usage count
|
23 |
+
current_count = read_counter()
|
24 |
+
st.write(f"App has been used **{current_count}** times.")
|
25 |
+
|
26 |
+
# Button to analyze contract
|
27 |
+
if st.button("Analyze Contract"):
|
28 |
+
new_count = update_counter()
|
29 |
+
st.success(f"Contract analyzed! Total app usage: {new_count}")
|