From 05e131242d79b607664fb2d5e4a2c39d82ace90a Mon Sep 17 00:00:00 2001 From: msp259 Date: Thu, 30 Nov 2023 08:39:54 -0500 Subject: [PATCH 1/2] module import errors --- src/api/backend.py | 8 +++++++- src/format.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/backend.py b/src/api/backend.py index e1cc9cb3..8380a5a2 100644 --- a/src/api/backend.py +++ b/src/api/backend.py @@ -10,7 +10,13 @@ import os import subprocess from dotenv import load_dotenv -from format import Format + +import sys +import os + +from ..format import Format + + # Amazon S3 Connection load_dotenv() diff --git a/src/format.py b/src/format.py index 3a04939a..18b9ef92 100644 --- a/src/format.py +++ b/src/format.py @@ -1,6 +1,6 @@ # results_formatter.py import json -from state import GameState # Assuming GameState class is in state.py +from .state import GameState # Assuming GameState class is in state.py class Format: def results(): return format_results_for_api(GameState) From 85c0f42e3963907aa3d3f5dd26a5e9190e4ce9ea Mon Sep 17 00:00:00 2001 From: msp259 Date: Thu, 30 Nov 2023 08:59:27 -0500 Subject: [PATCH 2/2] add minimap --- src/api/backend.py | 9 +++++++++ src/view/app.py | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/api/backend.py b/src/api/backend.py index 8380a5a2..45cc5737 100644 --- a/src/api/backend.py +++ b/src/api/backend.py @@ -88,3 +88,12 @@ async def get_formatted_results(): except Exception as e: raise HTTPException(status_code=500, detail=str(e)) + +@app.get("/video") +async def get_videos(): + file_path = 'tmp/minimap.mp4' + def iterfile(): + with open(file_path, mode="rb") as file_like: + yield from file_like + + return StreamingResponse(iterfile(), media_type="video/mp4") \ No newline at end of file diff --git a/src/view/app.py b/src/view/app.py index 75c225fa..8061a0c7 100644 --- a/src/view/app.py +++ b/src/view/app.py @@ -125,8 +125,19 @@ def results_page(): # Results These are the results. Here's the processed video and a minimap of the player positions. """ + ) # st.video(open(st.session_state.processed_video, "rb").read()) + #here we need to add the call for the videos + + + response = requests.get(SERVER_URL + "video") + if response.status_code == 200: + video_bytes = response.content() # Returns the formatted results as JSON + video_bytes = response + st.video(video_bytes) + else: + st.header ("error- Failed to retrieve data from the backend.") st.markdown("## Statistics")