ThomasSimonini HF staff commited on
Commit
59d1d33
·
1 Parent(s): 2210ed3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -28
app.py CHANGED
@@ -3,30 +3,21 @@ 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(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_1, 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_2, filename="replay.mp4")
28
-
29
- return video_path_1, results_1, video_path_2, results_2
30
 
31
 
32
  def parse_metrics_accuracy(meta):
@@ -52,19 +43,12 @@ def get_metadata(model_id):
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
 
 
3
  from huggingface_hub import HfApi, hf_hub_download
4
  from huggingface_hub.repocard import metadata_load
5
 
6
+ def load_agent(model_id):
7
  """
8
  This function load the agent's video and results
9
  :return: video_path
10
  """
11
  # Load the metrics
12
+ metadata = get_metadata(model_id)
13
 
14
  # Get the accuracy
15
+ results = parse_metrics_accuracy(metadata)
16
 
17
  # Load the video
18
+ video_path = hf_hub_download(model_id, filename="replay.mp4")
19
+
20
+ return video_path, results
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  def parse_metrics_accuracy(meta):
 
43
  return None
44
 
45
 
46
+ agent1 = gr.Interface(load_agent, gr.Textbox(
47
+ label="model_1",
48
+ ), ["video", "text"])
49
+ agent2 = gr.Interface(load_agent, gr.Textbox(
50
+ label="model_2",
51
+ ), ["video", "text"])
 
 
 
 
 
 
 
52
 
53
 
54