Spaces:
Running
Running
phyloforfun
commited on
Commit
•
2a414d1
1
Parent(s):
a55a649
refactor
Browse files
app.py
CHANGED
@@ -33,12 +33,51 @@ N_OVERALL_STEPS = 6
|
|
33 |
########################################################################################################
|
34 |
### Progress bar ####
|
35 |
########################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
class ProgressReport:
|
37 |
-
def __init__(self,
|
38 |
-
self.
|
39 |
-
self.batch_bar = batch_bar
|
40 |
-
self.text_overall = text_overall
|
41 |
-
self.text_batch = text_batch
|
42 |
self.current_overall_step = 0
|
43 |
self.total_overall_steps = 20 # number of major steps in machine function
|
44 |
self.current_batch = 0
|
@@ -46,35 +85,28 @@ class ProgressReport:
|
|
46 |
|
47 |
def update_overall(self, step_name=""):
|
48 |
self.current_overall_step += 1
|
49 |
-
self.
|
50 |
-
self.
|
51 |
|
52 |
def update_batch(self, step_name=""):
|
53 |
self.current_batch += 1
|
54 |
-
self.
|
55 |
-
self.
|
56 |
|
57 |
def set_n_batches(self, n_batches):
|
58 |
self.total_batches = n_batches
|
59 |
|
60 |
def set_n_overall(self, total_overall_steps):
|
61 |
self.current_overall_step = 0
|
62 |
-
self.
|
63 |
-
self.total_overall_steps = total_overall_steps
|
64 |
|
65 |
-
def reset_batch(self, step_name):
|
66 |
self.current_batch = 0
|
67 |
-
self.
|
68 |
-
|
69 |
-
def reset_overall(self, step_name):
|
70 |
self.current_overall_step = 0
|
71 |
-
self.
|
72 |
-
self.text_overall.text(step_name)
|
73 |
-
|
74 |
-
def get_n_images(self):
|
75 |
-
return self.n_images
|
76 |
-
def get_n_overall(self):
|
77 |
-
return self.total_overall_steps
|
78 |
|
79 |
|
80 |
|
@@ -957,24 +989,53 @@ The desired null value is also given. Populate the field with the null value of
|
|
957 |
}
|
958 |
st.json(st.session_state['prompt_info'])
|
959 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
def content_header():
|
961 |
# Header section, run, quick start, API report
|
962 |
col_run_1, col_run_2, col_run_3, col_run_4 = st.columns([2,2,2,2])
|
963 |
|
964 |
-
# Progress bar
|
965 |
col_run_info_1 = st.columns([1])[0]
|
966 |
|
967 |
with col_run_info_1:
|
968 |
-
#
|
969 |
st.subheader("Overall Progress")
|
970 |
-
|
971 |
text_overall = st.empty() # Placeholder for current step name
|
972 |
|
973 |
st.subheader('Transcription Progress')
|
974 |
-
|
975 |
text_batch = st.empty() # Placeholder for current step name
|
976 |
|
977 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
978 |
|
979 |
st.info("***Note:*** There is a known bug with tabs in Streamlit. If you update an input field it may take you back to the 'Project Settings' tab. Changes that you made are saved, it's just an annoying glitch. We are aware of this issue and will fix it as soon as we can.")
|
980 |
st.write("If you use VoucherVision frequently, you can change the default values that are auto-populated in the form below. In a text editor or IDE, edit the first few rows in the file `../VoucherVision/vouchervision/VoucherVision_Config_Builder.py`")
|
|
|
33 |
########################################################################################################
|
34 |
### Progress bar ####
|
35 |
########################################################################################################
|
36 |
+
# class ProgressReport:
|
37 |
+
# def __init__(self, overall_bar, batch_bar, text_overall, text_batch):
|
38 |
+
# self.overall_bar = overall_bar
|
39 |
+
# self.batch_bar = batch_bar
|
40 |
+
# self.text_overall = text_overall
|
41 |
+
# self.text_batch = text_batch
|
42 |
+
# self.current_overall_step = 0
|
43 |
+
# self.total_overall_steps = 20 # number of major steps in machine function
|
44 |
+
# self.current_batch = 0
|
45 |
+
# self.total_batches = 20
|
46 |
+
|
47 |
+
# def update_overall(self, step_name=""):
|
48 |
+
# self.current_overall_step += 1
|
49 |
+
# self.overall_bar.progress(self.current_overall_step / self.total_overall_steps)
|
50 |
+
# self.text_overall.text(step_name)
|
51 |
+
|
52 |
+
# def update_batch(self, step_name=""):
|
53 |
+
# self.current_batch += 1
|
54 |
+
# self.batch_bar.progress(self.current_batch / self.total_batches)
|
55 |
+
# self.text_batch.text(step_name)
|
56 |
+
|
57 |
+
# def set_n_batches(self, n_batches):
|
58 |
+
# self.total_batches = n_batches
|
59 |
+
|
60 |
+
# def set_n_overall(self, total_overall_steps):
|
61 |
+
# self.current_overall_step = 0
|
62 |
+
# self.overall_bar.progress(0)
|
63 |
+
# self.total_overall_steps = total_overall_steps
|
64 |
+
|
65 |
+
# def reset_batch(self, step_name):
|
66 |
+
# self.current_batch = 0
|
67 |
+
# self.batch_bar.progress(0)
|
68 |
+
# self.text_batch.text(step_name)
|
69 |
+
# def reset_overall(self, step_name):
|
70 |
+
# self.current_overall_step = 0
|
71 |
+
# self.overall_bar.progress(0)
|
72 |
+
# self.text_overall.text(step_name)
|
73 |
+
|
74 |
+
# def get_n_images(self):
|
75 |
+
# return self.n_images
|
76 |
+
# def get_n_overall(self):
|
77 |
+
# return self.total_overall_steps
|
78 |
class ProgressReport:
|
79 |
+
def __init__(self, update_progress):
|
80 |
+
self.update_progress = update_progress
|
|
|
|
|
|
|
81 |
self.current_overall_step = 0
|
82 |
self.total_overall_steps = 20 # number of major steps in machine function
|
83 |
self.current_batch = 0
|
|
|
85 |
|
86 |
def update_overall(self, step_name=""):
|
87 |
self.current_overall_step += 1
|
88 |
+
overall_progress = self.current_overall_step / self.total_overall_steps
|
89 |
+
self.update_progress(overall_progress=overall_progress, overall_text=step_name)
|
90 |
|
91 |
def update_batch(self, step_name=""):
|
92 |
self.current_batch += 1
|
93 |
+
batch_progress = self.current_batch / self.total_batches
|
94 |
+
self.update_progress(batch_progress=batch_progress, batch_text=step_name)
|
95 |
|
96 |
def set_n_batches(self, n_batches):
|
97 |
self.total_batches = n_batches
|
98 |
|
99 |
def set_n_overall(self, total_overall_steps):
|
100 |
self.current_overall_step = 0
|
101 |
+
self.update_progress(overall_progress=0, overall_text="")
|
|
|
102 |
|
103 |
+
def reset_batch(self, step_name=""):
|
104 |
self.current_batch = 0
|
105 |
+
self.update_progress(batch_progress=0, batch_text=step_name)
|
106 |
+
|
107 |
+
def reset_overall(self, step_name=""):
|
108 |
self.current_overall_step = 0
|
109 |
+
self.update_progress(overall_progress=0, overall_text=step_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
|
112 |
|
|
|
989 |
}
|
990 |
st.json(st.session_state['prompt_info'])
|
991 |
|
992 |
+
# def content_header():
|
993 |
+
# # Header section, run, quick start, API report
|
994 |
+
# col_run_1, col_run_2, col_run_3, col_run_4 = st.columns([2,2,2,2])
|
995 |
+
|
996 |
+
# # Progress bar
|
997 |
+
# col_run_info_1 = st.columns([1])[0]
|
998 |
+
|
999 |
+
# with col_run_info_1:
|
1000 |
+
# # Progress
|
1001 |
+
# st.subheader("Overall Progress")
|
1002 |
+
# overall_progress_bar = st.progress(0)
|
1003 |
+
# text_overall = st.empty() # Placeholder for current step name
|
1004 |
+
|
1005 |
+
# st.subheader('Transcription Progress')
|
1006 |
+
# batch_progress_bar = st.progress(0)
|
1007 |
+
# text_batch = st.empty() # Placeholder for current step name
|
1008 |
+
|
1009 |
+
# progress_report = ProgressReport(overall_progress_bar, batch_progress_bar, text_overall, text_batch)
|
1010 |
def content_header():
|
1011 |
# Header section, run, quick start, API report
|
1012 |
col_run_1, col_run_2, col_run_3, col_run_4 = st.columns([2,2,2,2])
|
1013 |
|
1014 |
+
# Progress bar placeholders
|
1015 |
col_run_info_1 = st.columns([1])[0]
|
1016 |
|
1017 |
with col_run_info_1:
|
1018 |
+
# Placeholders for the progress bars
|
1019 |
st.subheader("Overall Progress")
|
1020 |
+
overall_progress_placeholder = st.empty() # Placeholder for overall progress bar
|
1021 |
text_overall = st.empty() # Placeholder for current step name
|
1022 |
|
1023 |
st.subheader('Transcription Progress')
|
1024 |
+
batch_progress_placeholder = st.empty() # Placeholder for batch progress bar
|
1025 |
text_batch = st.empty() # Placeholder for current step name
|
1026 |
|
1027 |
+
# Function to update progress
|
1028 |
+
def update_progress(overall_progress, batch_progress, overall_text, batch_text):
|
1029 |
+
if overall_progress is not None:
|
1030 |
+
overall_progress_bar = overall_progress_placeholder.progress(overall_progress)
|
1031 |
+
if batch_progress is not None:
|
1032 |
+
batch_progress_bar = batch_progress_placeholder.progress(batch_progress)
|
1033 |
+
if overall_text is not None:
|
1034 |
+
text_overall.text(overall_text)
|
1035 |
+
if batch_text is not None:
|
1036 |
+
text_batch.text(batch_text)
|
1037 |
+
|
1038 |
+
progress_report = ProgressReport(update_progress)
|
1039 |
|
1040 |
st.info("***Note:*** There is a known bug with tabs in Streamlit. If you update an input field it may take you back to the 'Project Settings' tab. Changes that you made are saved, it's just an annoying glitch. We are aware of this issue and will fix it as soon as we can.")
|
1041 |
st.write("If you use VoucherVision frequently, you can change the default values that are auto-populated in the form below. In a text editor or IDE, edit the first few rows in the file `../VoucherVision/vouchervision/VoucherVision_Config_Builder.py`")
|