Spaces:
Sleeping
Sleeping
import pandas as pd | |
import streamlit as st | |
import requests | |
from io import BytesIO | |
from PIL import Image | |
data_titles = pd.read_pickle("data/2k_titles.pkl") | |
data_ids = pd.read_pickle("data/2k_ids.pkl") | |
def ids_to_titles(ids_list): | |
return [data_ids[title] for title in ids_list] | |
def titles_to_ids(titles_list): | |
return [data_titles[id] for id in titles_list] | |
def generate_app_gamebox(titles): | |
""" | |
Placeholder | |
""" | |
titles_id = titles_to_ids(titles) | |
for id in titles_id: | |
url = f"https://cdn.cloudflare.steamstatic.com/steam/apps/{id}/header.jpg" | |
resp = requests.get(url) | |
if resp.status_code == 200: | |
container = st.container() | |
img_col, pref_col = container.columns([3, 2]) | |
img_col.image(BytesIO(resp.content)) | |
pref_col.selectbox( | |
"Your rating:", | |
options=["Positive", "Negative"], | |
key=id, | |
) | |
return titles_id | |
def generate_res_gamebox(ids): | |
""" | |
Placeholder | |
""" | |
for id in ids: | |
url_page = f"https://store.steampowered.com/app/{id}/" | |
url_img = f"https://cdn.cloudflare.steamstatic.com/steam/apps/{id}/header.jpg" | |
resp = requests.get(url_img) | |
if resp.status_code == 200: | |
with st.container(): | |
st.image(BytesIO(resp.content)) | |
st.caption(data_ids[id]) | |
st.divider() | |
def combine_hybrid_result(): | |
pass | |
# for title in titles_list: | |
# # url = f"https://store.steampowered.com/app/" | |
# with st.container(): | |