Spaces:
Runtime error
Runtime error
Commit
·
11f4e8a
1
Parent(s):
a7f9769
Update app.py
Browse files
app.py
CHANGED
@@ -3,22 +3,30 @@ 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(
|
7 |
"""
|
8 |
This function load the agent's video and results
|
9 |
:return: video_path
|
10 |
"""
|
11 |
# Load the metrics
|
12 |
-
|
13 |
|
14 |
# Get the accuracy
|
15 |
-
|
16 |
|
17 |
# Load the video
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
def parse_metrics_accuracy(meta):
|
@@ -43,8 +51,22 @@ def get_metadata(model_id):
|
|
43 |
except requests.exceptions.HTTPError:
|
44 |
return None
|
45 |
|
46 |
-
agent1 = gr.Interface(load_agent, "text", ["video", "text"])
|
47 |
-
agent2 = gr.Interface(load_agent, "text", ["video", "text"])
|
48 |
|
49 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
|
|
3 |
from huggingface_hub import HfApi, hf_hub_download
|
4 |
from huggingface_hub.repocard import metadata_load
|
5 |
|
6 |
+
def load_agent(model_id_1, model_id_2):
|
7 |
"""
|
8 |
This function load the agent's video and results
|
9 |
:return: video_path
|
10 |
"""
|
11 |
# Load the metrics
|
12 |
+
metadata_1 = get_metadata(model_id_1)
|
13 |
|
14 |
# Get the accuracy
|
15 |
+
results_1 = parse_metrics_accuracy(metadata_1)
|
16 |
|
17 |
# Load the video
|
18 |
+
video_path_1 = hf_hub_download(model_id, filename="replay.mp4")
|
19 |
|
20 |
+
# Load the metrics
|
21 |
+
metadata_2 = get_metadata(model_id_2)
|
22 |
+
|
23 |
+
# Get the accuracy
|
24 |
+
results_2 = parse_metrics_accuracy(metadata_2)
|
25 |
+
|
26 |
+
# Load the video
|
27 |
+
video_path_2 = hf_hub_download(model_id, filename="replay.mp4")
|
28 |
+
|
29 |
+
return video_path_1, results_1, video_path_2, results_2
|
30 |
|
31 |
|
32 |
def parse_metrics_accuracy(meta):
|
|
|
51 |
except requests.exceptions.HTTPError:
|
52 |
return None
|
53 |
|
|
|
|
|
54 |
|
55 |
+
gr.Interface(load_agent,
|
56 |
+
[
|
57 |
+
gr.Textbox(
|
58 |
+
label="Model 1",
|
59 |
+
),
|
60 |
+
gr.Textbox(
|
61 |
+
label="Model 2",
|
62 |
+
),
|
63 |
+
],
|
64 |
+
["video", "text", "video", "text"]
|
65 |
+
).launch()
|
66 |
+
#agent1 = gr.Interface(load_agent, "text", ["video", "text"])
|
67 |
+
#agent2 = gr.Interface(load_agent, "text", ["video", "text"])
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
#gr.Series(agent1, agent2).launch()
|
72 |
|