added progressbar
This commit is contained in:
@@ -17,6 +17,8 @@ from src.database import connect
|
||||
from src.database import get_visual_communication
|
||||
from src.database import ModelOutputs
|
||||
from src.database import NoDocumentFoundException
|
||||
from src.database import total_annotated
|
||||
from src.database import total_documents
|
||||
from src.database import upsert_annotations
|
||||
from src.database import upsert_visual_communication
|
||||
from src.database import VisualCommunication
|
||||
@@ -66,6 +68,27 @@ def show_success(
|
||||
return True, msg
|
||||
|
||||
|
||||
@app.callback(
|
||||
Output('progress-bar', 'value'),
|
||||
Output('progress-bar', 'max'),
|
||||
Output('progress-bar', 'label'),
|
||||
Input('next-button', 'n_clicks'),
|
||||
Input('upload-data', 'filename'),
|
||||
)
|
||||
def update_progress_bar(
|
||||
n_clicks: int,
|
||||
filename_list: list[str] | None,
|
||||
):
|
||||
logging.info('began updating progress bar')
|
||||
global collection
|
||||
# get values from database
|
||||
num_total = total_documents(collection=collection)
|
||||
num_handled = total_annotated(collection=collection)
|
||||
limit = int(num_total/20)
|
||||
label_str = f"{num_handled}/{num_total}" if num_handled >= limit else ''
|
||||
return num_handled, num_total, label_str
|
||||
|
||||
|
||||
@app.callback(
|
||||
Output('success-message', 'data', allow_duplicate=True),
|
||||
Output('alert-message', 'data', allow_duplicate=True),
|
||||
|
||||
Reference in New Issue
Block a user