Skip to content

Commit

Permalink
Merge pull request #4 from AnsahMohammad/AnsahMohammad-patch-2
Browse files Browse the repository at this point in the history
Resolved the bug of unstability
  • Loading branch information
AnsahMohammad committed Oct 3, 2022
2 parents 4b07d3a + 65a6e5a commit b891292
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions UI.py
Expand Up @@ -3,18 +3,20 @@
st.subheader(" Entering your private Information in this Version is deprecated ! Thank You ! ")
st.title('Fiesta : Wear Uniquely !')

def exit():
st.error("Sorry an error occured")

def Shuff(t):
if(t%3!=0):
raise ValueError
return None
# if(t%3!=0):
# print("Value Error")
# exit()
# assuming t will always be multiple of 3 since we're using radio to choose number of clothes
u_length = int(t/3)
kernal_length = int(t/3) * 2
solution = []
t1 = [i for i in range(1,kernal_length+1)]
u = [i+kernal_length+1 for i in range(u_length)]
initial = list(t1)
# print(t1)
# print(u)
solution.append(t1)
flag = True
while(True):
Expand All @@ -26,12 +28,10 @@ def Shuff(t):
i += 1
t2.append(t1[j])
j += 1
# print("Finished iteration ",t2)
u = t1[kernal_length//2:]
t1 = t2

if(t2 == initial):
# print("Solution Found")
break
solution.append(t2)
return solution
Expand All @@ -42,22 +42,17 @@ def fetch(num,database):

def work(database):
k = st.number_input('Select a Week',1,100)
# if(k == 0):
# return 0
data = fetch(k,database)
days = ['Mon','Tue','Wed','Thu','Fri','Sat']
i = 0
for each in data:
st.write("{} {}".format(days[i%6],database[each]))
i += 1
# work(database)
i += 1

tab1, tab2 = st.tabs(["Wadrobe","Edit the Wadrobe"])
# tab1.write("What to Wear")
# tab2.write("Edit")

with tab2:
num = st.slider('Select Number of Clothes',5,33)
num = st.radio("Enter number of clothes : ",[6,9,12,15,18,21,24,27,30])
if(num%3==0):
f = open('data.txt','w')
dress = st.text_area("Feed in your clothes saperated by ',' :")
Expand All @@ -71,34 +66,36 @@ def work(database):
j += 1
else:
st.write("Clothes Must be multiple of three for this Algorithm to work")
k = st.button("Confirm")
if(k):
st.success('Added {} clothes to the Wadrobe ✅'.format(len(dress)))

if(num%3 == 0 and len(dress) > 0 ):
st.write('Added {} clothes to the Wadrobe ✅'.format(len(dress)))

#flag to know if data is present or not
cflag = 0
database = {}
with tab1:
try:
f = open('data.txt','r')
except:
st.write("You have Not created a Wadrobe")
st.error("You have Not created a Wadrobe")
st.write("Go to Wadrobe Tab to create One")
else:
col1, col2, col3 = st.columns(3)
st.subheader("Wadrobe")
dress = f.read().split(",")
for i in range(0,len(dress),3):
st.write("{} | {} | {}".format(dress[i],dress[i+1],dress[i+2]))
for i in range(0,len(dress)):
if i%3 == 0:
col1.write(dress[i])
elif i%3 == 1:
col2.write(dress[i])
elif i%3 == 2:
col3.write(dress[i])

j = 1
for each in dress:
database[j] = each
j += 1
cflag = 1

if(cflag):
st.subheader("What to Wear ? :")
work(database)

st.subheader("What to Wear ? :")
work(database)


# st.write("With ❤️ from AnsahMohammad")

0 comments on commit b891292

Please sign in to comment.