from typing import Dict, Text import numpy as np import tensorflow as tf import pandas as pd import pickle import numpy as np import tensorflow as tf import tensorflow_recommenders as tfrs import streamlit as st from html_information import html import pandas as pd import json def read_json(file_name): with open(file_name) as json_file: data = json.load(json_file) return data uid_name_map = read_json('uid_name_map.json') uid_url_map = read_json('uid_url_map.json') print(uid_name_map) print(uid_url_map) st.set_page_config(page_title="My App", page_icon=":guardsman:", layout="wide", initial_sidebar_state="auto") @st.cache_resource def load_model(path): loaded = tf.saved_model.load(path) return loaded def inference(model, user_id): scores, titles = model([user_id]) recs = titles[0, :15] extracted_rec = [] for rec in recs: extracted_rec.append(int(rec.numpy().decode('utf-8'))) return extracted_rec def read_pickle_file(file_path): with open(file_path, 'rb') as f: data = pickle.load(f) return data def streamlit_carousel(header_name: str, rec_item_url: list, rec_item_name: list) -> None: st.header(header_name) mid_section = "" for index, value in enumerate(rec_item_url): mid_section += """
""" + str(rec_item_name[index]) + """