trying to visualize
Browse files
app.py
CHANGED
@@ -14,13 +14,13 @@ import os
|
|
14 |
|
15 |
from submit import submit_boundary
|
16 |
from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
|
17 |
-
from utils import
|
18 |
from visualize import make_visual
|
19 |
from evaluation import load_boundary, load_boundaries
|
20 |
|
21 |
def evaluate_boundary(filename):
|
22 |
print(filename)
|
23 |
-
local_path =
|
24 |
with Path(local_path).open("r") as f:
|
25 |
raw = f.read()
|
26 |
data_dict = json.loads(raw)
|
@@ -113,7 +113,7 @@ def gradio_interface() -> gr.Blocks:
|
|
113 |
plot = gr.Plot()
|
114 |
|
115 |
def get_boundary_vis(selected_file):
|
116 |
-
local_path =
|
117 |
with Path(local_path).open("r") as f:
|
118 |
raw = f.read()
|
119 |
data_dict = json.loads(raw)
|
|
|
14 |
|
15 |
from submit import submit_boundary
|
16 |
from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
|
17 |
+
from utils import read_submission_from_hub, read_result_from_hub, write_results, get_user, make_user_clickable, make_boundary_clickable
|
18 |
from visualize import make_visual
|
19 |
from evaluation import load_boundary, load_boundaries
|
20 |
|
21 |
def evaluate_boundary(filename):
|
22 |
print(filename)
|
23 |
+
local_path = read_submission_from_hub(filename)
|
24 |
with Path(local_path).open("r") as f:
|
25 |
raw = f.read()
|
26 |
data_dict = json.loads(raw)
|
|
|
113 |
plot = gr.Plot()
|
114 |
|
115 |
def get_boundary_vis(selected_file):
|
116 |
+
local_path = read_result_from_hub(selected_file)
|
117 |
with Path(local_path).open("r") as f:
|
118 |
raw = f.read()
|
119 |
data_dict = json.loads(raw)
|
submit.py
CHANGED
@@ -23,8 +23,6 @@ def submit_boundary(
|
|
23 |
) -> str:
|
24 |
|
25 |
# error handling
|
26 |
-
print(profile)
|
27 |
-
print("the profile name is: ", profile.username)
|
28 |
if profile.username is None:
|
29 |
raise gr.Error("You must be logged in to submit a file.")
|
30 |
|
|
|
23 |
) -> str:
|
24 |
|
25 |
# error handling
|
|
|
|
|
26 |
if profile.username is None:
|
27 |
raise gr.Error("You must be logged in to submit a file.")
|
28 |
|
utils.py
CHANGED
@@ -21,7 +21,15 @@ def make_boundary_clickable(filename):
|
|
21 |
link =f'https://huggingface.co/datasets/proxima-fusion/constellaration-bench-results/blob/main/{filename}'
|
22 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">link</a>'
|
23 |
|
24 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
local_path = hf_hub_download(
|
26 |
repo_id=submissions_repo,
|
27 |
repo_type="dataset",
|
|
|
21 |
link =f'https://huggingface.co/datasets/proxima-fusion/constellaration-bench-results/blob/main/{filename}'
|
22 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">link</a>'
|
23 |
|
24 |
+
def read_result_from_hub(filename):
|
25 |
+
local_path = hf_hub_download(
|
26 |
+
repo_id=results_repo,
|
27 |
+
repo_type="dataset",
|
28 |
+
filename=filename,
|
29 |
+
)
|
30 |
+
return local_path
|
31 |
+
|
32 |
+
def read_submission_from_hub(filename):
|
33 |
local_path = hf_hub_download(
|
34 |
repo_id=submissions_repo,
|
35 |
repo_type="dataset",
|