kostis-init commited on
Commit
f021e7d
Β·
1 Parent(s): 15bdc2b

minor changes

Browse files
Files changed (4) hide show
  1. Dockerfile +2 -8
  2. app.py +1 -3
  3. setup.sh +1 -1
  4. src/hf_utils.py +2 -8
Dockerfile CHANGED
@@ -1,7 +1,5 @@
1
- # Start from a base Python image
2
  FROM python:3.12-slim
3
 
4
- # Install wget and other potential necessities like ca-certificates
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
  wget \
7
  ca-certificates \
@@ -10,17 +8,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
10
  # Set the working directory in the container
11
  WORKDIR /app
12
 
13
- # Copy your setup script and application files
14
  COPY setup.sh .
15
  COPY requirements.txt .
16
  COPY app.py .
17
  COPY src/ ./src/
18
 
19
- # Make setup.sh executable and run it
20
  RUN chmod +x setup.sh && ./setup.sh
21
 
22
  # make the files
23
- RUN mkdir -p /app/temp_hf_downloads && chmod 777 /app/temp_hf_downloads
24
 
25
  # Install Python dependencies
26
  RUN pip install --no-cache-dir -r requirements.txt
@@ -28,10 +24,8 @@ RUN pip install --no-cache-dir -r requirements.txt
28
  # Environment variables for MiniZinc
29
  ENV MZN_DIR=/opt/minizinc
30
  ENV PATH="${MZN_DIR}/bin:${PATH}"
31
- # If MiniZinc has shared libraries in MZN_DIR/lib that are needed at runtime:
32
- ENV LD_LIBRARY_PATH="${MZN_DIR}/lib:${LD_LIBRARY_PATH}"
33
 
34
  # Expose the port Gradio runs on (default is 7860)
35
- EXPOSE 7860
36
 
37
  CMD ["python", "app.py"]
 
 
1
  FROM python:3.12-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends \
4
  wget \
5
  ca-certificates \
 
8
  # Set the working directory in the container
9
  WORKDIR /app
10
 
 
11
  COPY setup.sh .
12
  COPY requirements.txt .
13
  COPY app.py .
14
  COPY src/ ./src/
15
 
 
16
  RUN chmod +x setup.sh && ./setup.sh
17
 
18
  # make the files
19
+ RUN mkdir -p /app/local_hf_downloads && chmod 777 /app/local_hf_downloads
20
 
21
  # Install Python dependencies
22
  RUN pip install --no-cache-dir -r requirements.txt
 
24
  # Environment variables for MiniZinc
25
  ENV MZN_DIR=/opt/minizinc
26
  ENV PATH="${MZN_DIR}/bin:${PATH}"
 
 
27
 
28
  # Expose the port Gradio runs on (default is 7860)
29
+ #EXPOSE 7860
30
 
31
  CMD ["python", "app.py"]
app.py CHANGED
@@ -6,8 +6,6 @@ from src.ui import create_ui
6
  try:
7
  version = subprocess.check_output(["minizinc", "--version"], text=True, stderr=subprocess.STDOUT)
8
  print(f"🧠 MiniZinc version (from Docker env): {version.strip()}")
9
- solvers = subprocess.check_output(["minizinc", "--solvers"], text=True, stderr=subprocess.STDOUT)
10
- print(f"πŸ’‘ MiniZinc solvers (from Docker env):\n{solvers.strip()}")
11
  except FileNotFoundError:
12
  print("❌ MiniZinc command not found. Check PATH in Dockerfile and setup.sh.")
13
  except subprocess.CalledProcessError as e:
@@ -19,4 +17,4 @@ if __name__ == "__main__":
19
  print("Starting the Gradio app...", flush=True)
20
  demo = create_ui()
21
  print("Gradio app created successfully.", flush=True)
22
- demo.queue().launch()
 
6
  try:
7
  version = subprocess.check_output(["minizinc", "--version"], text=True, stderr=subprocess.STDOUT)
8
  print(f"🧠 MiniZinc version (from Docker env): {version.strip()}")
 
 
9
  except FileNotFoundError:
10
  print("❌ MiniZinc command not found. Check PATH in Dockerfile and setup.sh.")
11
  except subprocess.CalledProcessError as e:
 
17
  print("Starting the Gradio app...", flush=True)
18
  demo = create_ui()
19
  print("Gradio app created successfully.", flush=True)
20
+ demo.launch()
setup.sh CHANGED
@@ -22,4 +22,4 @@ rm MiniZincIDE.tgz
22
  chmod -R +x ${MZN_DIR}/bin || true # Allow to fail if no bin dir yet, though it should exist.
23
  chmod -R +x ${MZN_DIR}/share/minizinc/solvers || true # Some solvers might be scripts
24
 
25
- echo "βœ… setup.sh finished installing MiniZinc to ${MZN_DIR}" > setup_log.txt
 
22
  chmod -R +x ${MZN_DIR}/bin || true # Allow to fail if no bin dir yet, though it should exist.
23
  chmod -R +x ${MZN_DIR}/share/minizinc/solvers || true # Some solvers might be scripts
24
 
25
+ echo "βœ… setup.sh finished installing MiniZinc to ${MZN_DIR}"
src/hf_utils.py CHANGED
@@ -62,12 +62,11 @@ def load_leaderboard_data():
62
  continue
63
 
64
  # Download summary file
65
- temp_dir = os.path.join("temp_hf_downloads", dir_name)
66
  local_summary_path = hf_hub_download(
67
  repo_id=DATASET_REPO_ID,
68
  filename=f"{DS_RESULTS_PATH}/{dir_name}/summary.txt",
69
  repo_type="dataset",
70
- local_dir=temp_dir,
71
  )
72
 
73
  if Path(local_summary_path).exists():
@@ -87,12 +86,7 @@ def load_leaderboard_data():
87
 
88
  except Exception as e:
89
  print(f"Error loading leaderboard data: {e}")
90
-
91
- finally:
92
- # Clean up
93
- if Path("temp_hf_downloads").exists():
94
- shutil.rmtree("temp_hf_downloads", ignore_errors=True)
95
-
96
  if not leaderboard_entries:
97
  return pd.DataFrame(columns=LDB_COLS)
98
 
 
62
  continue
63
 
64
  # Download summary file
 
65
  local_summary_path = hf_hub_download(
66
  repo_id=DATASET_REPO_ID,
67
  filename=f"{DS_RESULTS_PATH}/{dir_name}/summary.txt",
68
  repo_type="dataset",
69
+ local_dir=os.path.join("local_hf_downloads", dir_name),
70
  )
71
 
72
  if Path(local_summary_path).exists():
 
86
 
87
  except Exception as e:
88
  print(f"Error loading leaderboard data: {e}")
89
+
 
 
 
 
 
90
  if not leaderboard_entries:
91
  return pd.DataFrame(columns=LDB_COLS)
92