Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ from PIL import Image
|
|
5 |
import matplotlib.pyplot as plt
|
6 |
import gradio as gr
|
7 |
import os
|
|
|
|
|
8 |
|
9 |
# Imports Hugging Face
|
10 |
from huggingface_hub import hf_hub_download, login
|
@@ -19,12 +21,25 @@ from inference_utils.inference import interactive_infer_image
|
|
19 |
from inference_utils.output_processing import check_mask_stats
|
20 |
from inference_utils.processing_utils import read_rgb, get_instances
|
21 |
|
|
|
22 |
def init_huggingface():
|
23 |
"""Initialise la connexion Hugging Face et télécharge le modèle."""
|
24 |
hf_token = os.getenv('HF_TOKEN')
|
25 |
if hf_token is None:
|
26 |
raise ValueError("Hugging Face token not found. Please set the HF_TOKEN environment variable.")
|
27 |
login(hf_token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
return hf_hub_download(
|
29 |
repo_id="microsoft/BiomedParse",
|
30 |
filename="biomedparse_v1.pt",
|
|
|
5 |
import matplotlib.pyplot as plt
|
6 |
import gradio as gr
|
7 |
import os
|
8 |
+
import subprocess
|
9 |
+
import sys
|
10 |
|
11 |
# Imports Hugging Face
|
12 |
from huggingface_hub import hf_hub_download, login
|
|
|
21 |
from inference_utils.output_processing import check_mask_stats
|
22 |
from inference_utils.processing_utils import read_rgb, get_instances
|
23 |
|
24 |
+
|
25 |
def init_huggingface():
|
26 |
"""Initialise la connexion Hugging Face et télécharge le modèle."""
|
27 |
hf_token = os.getenv('HF_TOKEN')
|
28 |
if hf_token is None:
|
29 |
raise ValueError("Hugging Face token not found. Please set the HF_TOKEN environment variable.")
|
30 |
login(hf_token)
|
31 |
+
packages = [
|
32 |
+
'openmpi-bin',
|
33 |
+
'libopenmpi-dev'
|
34 |
+
]
|
35 |
+
command = ['sudo', 'apt-get', 'install', '-y'] + packages
|
36 |
+
subprocess.run(
|
37 |
+
command,
|
38 |
+
check=True,
|
39 |
+
stdout=subprocess.PIPE,
|
40 |
+
stderr=subprocess.PIPE,
|
41 |
+
text=True
|
42 |
+
)
|
43 |
return hf_hub_download(
|
44 |
repo_id="microsoft/BiomedParse",
|
45 |
filename="biomedparse_v1.pt",
|