File size: 562 Bytes
d79f5f2
 
 
 
 
 
 
 
de7f21d
 
 
 
d79f5f2
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import List

import gradio as gr

MEDIA_PATH = "medias/"
MEDIA_FILE_TYPE = ".png"


def get_content(file_name: str) -> str:
    with open(file_name, "r", encoding="utf-8") as file:
        content = file.read()
    return content


def get_player_partners(player_info: gr.State) -> List[str]:
    return [
        f"{MEDIA_PATH}{partner}{MEDIA_FILE_TYPE}" for partner in player_info["partners"]
    ]


def get_player_badges(player_info: gr.State) -> List[str]:
    return [f"{MEDIA_PATH}{badge}{MEDIA_FILE_TYPE}" for badge in player_info["badges"]]