mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-03-12 12:25:32 +08:00
feat(feature-retrieval): add single image feature extraction method
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Optional
|
||||
from typing import List, Optional, Union
|
||||
|
||||
import dash_ag_grid as dag
|
||||
import dash_mantine_components as dmc
|
||||
@@ -7,24 +7,6 @@ from dash import Dash, Input, Output, State, callback, dcc, html
|
||||
from database import db_manager
|
||||
|
||||
|
||||
def parse_contents(contents, filename, date):
|
||||
return html.Div(
|
||||
[
|
||||
html.H5(filename),
|
||||
html.H6(datetime.datetime.fromtimestamp(date)),
|
||||
# HTML images accept base64 encoded strings in the same format
|
||||
# that is supplied by the upload
|
||||
html.Img(src=contents),
|
||||
html.Hr(),
|
||||
html.Div("Raw Content"),
|
||||
html.Pre(
|
||||
contents[0:200] + "...",
|
||||
style={"whiteSpace": "pre-wrap", "wordBreak": "break-all"},
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class APP(Dash):
|
||||
"""Singleton Dash Application"""
|
||||
|
||||
@@ -93,7 +75,22 @@ class APP(Dash):
|
||||
State("upload-image", "filename"),
|
||||
State("upload-image", "last_modified"),
|
||||
)
|
||||
def update_output(list_of_contents, list_of_names, list_of_dates):
|
||||
def update_output(
|
||||
list_of_contents: List[str],
|
||||
list_of_names: List[str],
|
||||
list_of_dates: List[int] | List[float],
|
||||
):
|
||||
def parse_contents(contents: str, filename: str, date: Union[int, float]):
|
||||
return html.Div(
|
||||
[
|
||||
html.H5(filename),
|
||||
html.H6(datetime.datetime.fromtimestamp(date)),
|
||||
# HTML images accept base64 encoded strings in the same format
|
||||
# that is supplied by the upload
|
||||
dmc.Image(src=contents),
|
||||
]
|
||||
)
|
||||
|
||||
if list_of_contents is not None:
|
||||
children = [
|
||||
parse_contents(c, n, d)
|
||||
|
||||
Reference in New Issue
Block a user