Skip to content

Commit

Permalink
Add model inference for demo (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
anneschuth authored Oct 16, 2024
2 parents 7cd6ab3 + 22f2e95 commit e26ed98
Show file tree
Hide file tree
Showing 8 changed files with 424 additions and 3 deletions.
3 changes: 3 additions & 0 deletions amt/api/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class Navigation:
PROJECT_DETAILS = BaseNavigationItem(
display_text=DisplayText.DETAILS, url="/project/{project_id}/details/system_card"
)
PROJECT_MODEL = BaseNavigationItem(
display_text=DisplayText.MODEL, url="/project/{project_id}/details/model/inference"
)
PROJECT_NEW = BaseNavigationItem(display_text=DisplayText.NEW, url="/projects/new")
PROJECT_SYSTEM_INFO = BaseNavigationItem(display_text=DisplayText.INFO, url="/project/{project_id}/details")
PROJECT_SYSTEM_ALGORITHM_DETAILS = BaseNavigationItem(
Expand Down
37 changes: 37 additions & 0 deletions amt/api/routes/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def get_project_details_tabs(request: Request) -> list[NavigationItem]:
[
Navigation.PROJECT_SYSTEM_INFO,
Navigation.PROJECT_SYSTEM_ALGORITHM_DETAILS,
Navigation.PROJECT_MODEL,
Navigation.PROJECT_REQUIREMENTS,
Navigation.PROJECT_DATA_CARD,
Navigation.PROJECT_TASKS,
Expand Down Expand Up @@ -242,6 +243,42 @@ async def get_system_card(
return templates.TemplateResponse(request, "pages/system_card.html.j2", context)


@router.get("/{project_id}/details/model/inference")
async def get_project_inference(
request: Request, project_id: int, projects_service: Annotated[ProjectsService, Depends(ProjectsService)]
) -> HTMLResponse:
project = get_project_or_error(project_id, projects_service, request)

breadcrumbs = resolve_base_navigation_items(
[
Navigation.PROJECTS_ROOT,
BaseNavigationItem(custom_display_text=project.name, url="/project/{project_id}/details/model/inference"),
Navigation.PROJECT_MODEL,
],
request,
)

system_card_data = get_system_card_data()
instrument_state = get_instrument_state()
requirements_state = get_requirements_state(project.system_card)

tab_items = get_project_details_tabs(request)

context = {
"lifecycle": get_lifecycle(project.lifecycle, request),
"last_edited": project.last_edited,
"system_card": system_card_data,
"instrument_state": instrument_state,
"requirements_state": requirements_state,
"project": project,
"project_id": project.id,
"breadcrumbs": breadcrumbs,
"tab_items": tab_items,
}

return templates.TemplateResponse(request, "projects/details_inference.html.j2", context)


# !!!
# Implementation of this endpoint is for now independent of the project ID, meaning
# that the same system card is rendered for all project ID's. This is due to the fact
Expand Down
58 changes: 57 additions & 1 deletion amt/locale/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-15 08:45+0200\n"
"POT-Creation-Date: 2024-10-16 08:58+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -363,6 +363,62 @@ msgstr ""
msgid "To be implemented"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:7
msgid "Floor area (m²):"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:16
msgid "Plot size (m²):"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:25
msgid "Building year:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:34
msgid "Object type:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:43
msgid "Number of annexes:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:52
msgid "Neighborhood code:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:61
msgid "Quality rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:73
msgid "Maintenance rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:85
msgid "Amenities rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:97
msgid "Location rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:113
msgid "Estimate WOZ Value"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:117
msgid "Estimated WOZ Value"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:119
msgid "Undefined"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:175
msgid "Failed to estimate WOZ value: "
msgstr ""

#: amt/site/templates/projects/details_info.html.j2:7
msgid "Description"
msgstr ""
Expand Down
Binary file modified amt/locale/en_US/LC_MESSAGES/messages.mo
Binary file not shown.
88 changes: 87 additions & 1 deletion amt/locale/en_US/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-15 08:45+0200\n"
"POT-Creation-Date: 2024-10-16 08:58+0200\n"
"PO-Revision-Date: 2024-07-25 21:01+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -364,6 +364,62 @@ msgstr ""
msgid "To be implemented"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:7
msgid "Floor area (m²):"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:16
msgid "Plot size (m²):"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:25
msgid "Building year:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:34
msgid "Object type:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:43
msgid "Number of annexes:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:52
msgid "Neighborhood code:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:61
msgid "Quality rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:73
msgid "Maintenance rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:85
msgid "Amenities rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:97
msgid "Location rating:"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:113
msgid "Estimate WOZ Value"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:117
msgid "Estimated WOZ Value"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:119
msgid "Undefined"
msgstr ""

#: amt/site/templates/projects/details_inference.html.j2:175
msgid "Failed to estimate WOZ value: "
msgstr ""

#: amt/site/templates/projects/details_info.html.j2:7
msgid "Description"
msgstr ""
Expand Down Expand Up @@ -467,3 +523,33 @@ msgstr ""
msgid "Copy results and close"
msgstr ""

#~ msgid "Algortime Management Toolkit"
#~ msgstr ""

#~ msgid "Inference"
#~ msgstr ""

#~ msgid "Sepal length:"
#~ msgstr ""

#~ msgid "Sepal width:"
#~ msgstr ""

#~ msgid "Petal length:"
#~ msgstr ""

#~ msgid "Petal width:"
#~ msgstr ""

#~ msgid "Run inference"
#~ msgstr ""

#~ msgid "Output"
#~ msgstr ""

#~ msgid "Output Probabilities"
#~ msgstr ""

#~ msgid "Failed to run inference: "
#~ msgstr ""

Binary file modified amt/locale/nl_NL/LC_MESSAGES/messages.mo
Binary file not shown.
58 changes: 57 additions & 1 deletion amt/locale/nl_NL/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-15 08:45+0200\n"
"POT-Creation-Date: 2024-10-16 08:58+0200\n"
"PO-Revision-Date: 2024-07-25 21:01+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: nl_NL\n"
Expand Down Expand Up @@ -372,6 +372,62 @@ msgstr "Ga naar all instrumenten"
msgid "To be implemented"
msgstr "Nog te implementeren"

#: amt/site/templates/projects/details_inference.html.j2:7
msgid "Floor area (m²):"
msgstr "Vloeroppervlakte (m²):"

#: amt/site/templates/projects/details_inference.html.j2:16
msgid "Plot size (m²):"
msgstr "Perceelgrootte (m²):"

#: amt/site/templates/projects/details_inference.html.j2:25
msgid "Building year:"
msgstr "Bouwjaar:"

#: amt/site/templates/projects/details_inference.html.j2:34
msgid "Object type:"
msgstr "Objecttype:"

#: amt/site/templates/projects/details_inference.html.j2:43
msgid "Number of annexes:"
msgstr "Aantal bijgebouwen:"

#: amt/site/templates/projects/details_inference.html.j2:52
msgid "Neighborhood code:"
msgstr "Buurtcode:"

#: amt/site/templates/projects/details_inference.html.j2:61
msgid "Quality rating:"
msgstr "Kwaliteitsbeoordeling:"

#: amt/site/templates/projects/details_inference.html.j2:73
msgid "Maintenance rating:"
msgstr "Onderhoudsbeoordeling:"

#: amt/site/templates/projects/details_inference.html.j2:85
msgid "Amenities rating:"
msgstr "Voorzieningenbeoordeling:"

#: amt/site/templates/projects/details_inference.html.j2:97
msgid "Location rating:"
msgstr "Locatiebeoordeling:"

#: amt/site/templates/projects/details_inference.html.j2:113
msgid "Estimate WOZ Value"
msgstr "WOZ-waarde schatten"

#: amt/site/templates/projects/details_inference.html.j2:117
msgid "Estimated WOZ Value"
msgstr "Geschatte WOZ-waarde"

#: amt/site/templates/projects/details_inference.html.j2:119
msgid "Undefined"
msgstr "Ongedefinieerd"

#: amt/site/templates/projects/details_inference.html.j2:175
msgid "Failed to estimate WOZ value: "
msgstr "Fout bij het schatten van de WOZ-waarde: "

#: amt/site/templates/projects/details_info.html.j2:7
msgid "Description"
msgstr "Omschrijving"
Expand Down
Loading

0 comments on commit e26ed98

Please sign in to comment.