Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
chore: add prompt viz, add new display for classifier and adjust layo…
Browse files Browse the repository at this point in the history
…ut for home
  • Loading branch information
d116626 committed Feb 7, 2024
1 parent 505ba08 commit c346ee0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/pages/Visualizar Prompt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import json

import pandas as pd
import streamlit as st
from utils.utils import get_objects, get_objetcs_labels_df, get_prompts
Expand All @@ -23,7 +25,9 @@


output_schema = """{\n "$defs": {\n "Object": {\n "properties": {\n "object": {\n"description": "The object from the objects table",\n"title": "Object",\n"type": "string"\n },\n "label_explanation": {\n"description": "Highly detailed visual description of the image given the object context",\n"title": "Label Explanation",\n"type": "string"\n },\n "label": {\n"anyOf": [\n {\n "type": "boolean"\n },\n {\n "type": "string"\n },\n {\n "type": "null"\n }\n],\n"description": "Label indicating the condition or characteristic of the object",\n"title": "Label"\n }\n },\n "required": [\n "object",\n "label_explanation",\n "label"\n ],\n "title": "Object",\n "type": "object"\n }\n },\n "properties": {\n "objects": {\n "items": {\n "$ref": "#/$defs/Object"\n },\n "title": "Objects",\n "type": "array"\n }\n },\n "required": [\n "objects"\n ],\n "title": "Output",\n "type": "object"\n}\n""" # noqa
output_schema = json.dumps(json.loads(output_schema), indent=4)
output_example = """{\n "objects": [\n {\n "object": "<Object from objects table>",\n "label_explanation": "<Visual description of the image given the object context>",\n "label": "<Selected label from objects table>"\n }\n ]\n}\n""" # noqa
output_example = json.dumps(json.loads(output_example), indent=4)

prompt_text = (
prompt_text.replace("{objects_table_md}", objects_table_md)
Expand Down
10 changes: 5 additions & 5 deletions app/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def callback_data():
return vision_api


vision_api = get_vision_ai_api()
# vision_api = APIVisionAI(
# username=os.environ.get("VISION_API_USERNAME"),
# password=os.environ.get("VISION_API_PASSWORD"),
# )
# vision_api = get_vision_ai_api()
vision_api = APIVisionAI(
username=os.environ.get("VISION_API_USERNAME"),
password=os.environ.get("VISION_API_PASSWORD"),
)


@st.cache_data(ttl=60 * 5, persist=False)
Expand Down

0 comments on commit c346ee0

Please sign in to comment.