ThomasFfefefef commited on
Commit
92913ed
1 Parent(s): 183335b

Add load video

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
.idea/Compare-Reinforcement-Learning-Agents.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/Compare-Reinforcement-Learning-Agents.iml" filepath="$PROJECT_DIR$/.idea/Compare-Reinforcement-Learning-Agents.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
__pycache__/app.cpython-38.pyc ADDED
Binary file (1.11 kB). View file
 
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests.exceptions
3
+ from huggingface_hub import HfApi, hf_hub_download
4
+ from huggingface_hub.repocard import metadata_load
5
+
6
+ def load_agent_video(model_id):
7
+ """
8
+ This function load the agent's video and results
9
+ :return: video_path
10
+ """
11
+ video_path = hf_hub_download(model_id, filename="replay.mp4")
12
+ return video_path
13
+
14
+ def get_metadata(model_id):
15
+ """
16
+ Get the metadata of the model repo
17
+ :param model_id:
18
+ :return: metadata
19
+ """
20
+ try:
21
+ readme_path = hf_hub_download(model_id, filename="README.md")
22
+ metadata = metadata_load(readme_path)
23
+ print(metadata)
24
+ return metadata
25
+ except requests.exceptions.HTTPError:
26
+ return None
27
+
28
+ agent1 = gr.Interface("text", load_agent_video(input), gr.Video(), "playable_video")
29
+ agent2 = gr.Interface("text", load_agent_video(input), gr.Video(), "playable_video")
30
+
31
+ gr.Parallel(agent1, agent2)
32
+