Spaces:
Build error
Build error
Initial commit with Git LFS setup
Browse files- .gitattributes +3 -0
- app.py +39 -0
- images/nipun-2.png +3 -0
- images/nipun-3.png +3 -0
- images/original.jpeg +3 -0
- requirements.txt +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os, json
|
| 3 |
+
|
| 4 |
+
IMG_DIR = "images"
|
| 5 |
+
VOTE_FILE = "votes.json"
|
| 6 |
+
|
| 7 |
+
# Ensure votes.json exists with image names
|
| 8 |
+
if not os.path.exists(VOTE_FILE):
|
| 9 |
+
votes = {}
|
| 10 |
+
|
| 11 |
+
if os.path.exists(VOTE_FILE):
|
| 12 |
+
with open(VOTE_FILE, 'r') as f:
|
| 13 |
+
votes = json.load(f)
|
| 14 |
+
|
| 15 |
+
# Initialize votes for new images
|
| 16 |
+
for img in os.listdir(IMG_DIR):
|
| 17 |
+
if img not in votes:
|
| 18 |
+
votes[img] = 0
|
| 19 |
+
|
| 20 |
+
# Save updated votes.json
|
| 21 |
+
with open(VOTE_FILE, 'w') as f:
|
| 22 |
+
json.dump(votes, f, indent=2)
|
| 23 |
+
|
| 24 |
+
st.title("Vote for the Best Logo")
|
| 25 |
+
|
| 26 |
+
# Display images and vote buttons
|
| 27 |
+
for img in sorted(votes.keys()):
|
| 28 |
+
st.image(os.path.join(IMG_DIR, img), width=200)
|
| 29 |
+
if st.button(f"Vote for {img}"):
|
| 30 |
+
votes[img] += 1
|
| 31 |
+
with open(VOTE_FILE, 'w') as f:
|
| 32 |
+
json.dump(votes, f, indent=2)
|
| 33 |
+
st.success(f"Voted for {img}")
|
| 34 |
+
st.experimental_rerun()
|
| 35 |
+
|
| 36 |
+
# Display current vote tally
|
| 37 |
+
st.header("Live Results")
|
| 38 |
+
for img, count in sorted(votes.items(), key=lambda x: -x[1]):
|
| 39 |
+
st.markdown(f"**{img}**: {count} votes")
|
images/nipun-2.png
ADDED
|
Git LFS Details
|
images/nipun-3.png
ADDED
|
Git LFS Details
|
images/original.jpeg
ADDED
|
Git LFS Details
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
streamlit
|