File size: 844 Bytes
55d18b1
 
5f5f7d9
55d18b1
 
5f5f7d9
 
 
55d18b1
 
 
 
 
5f5f7d9
 
 
 
 
 
 
 
 
 
 
55d18b1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st

def metadata2md(image_hash:str) -> str:
    """Get metadata from cache and return as markdown-formatted key-value list

    Args:
        image_hash (str): The hash of the image to get metadata for
        
    Returns:
        str: Markdown-formatted key-value list of metadata
        
    """
    markdown_str = "\n"
    # FIXME get the right keys
    # keys_to_print = ["latitude","longitude","author_email","date","time"]
    keys_to_print = ["latitude","longitude","author_email","date_option","time_option"]

    observation = st.session_state.public_observations.get(image_hash, {})
    
    #for key, value in st.session_state.public_observation.items():
    for key, value in observation.items():
        if key in keys_to_print:
            markdown_str += f"- **{key}**: {value}\n"

    return markdown_str