Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Try removing global var
Browse files- src/app.py +2 -7
src/app.py
CHANGED
@@ -5,19 +5,14 @@ from model_utils import calculate_memory, get_model
|
|
5 |
from huggingface_hub.utils import HfHubHTTPError
|
6 |
|
7 |
|
8 |
-
# We need to store them as globals because gradio doesn't have a way for us to pass them in to the button
|
9 |
-
MODEL = None
|
10 |
-
|
11 |
-
|
12 |
def get_results(model_name: str, library: str, options: list, access_token: str):
|
13 |
-
|
14 |
-
MODEL = get_model(model_name, library, access_token)
|
15 |
try:
|
16 |
has_discussion = check_for_discussion(model_name)
|
17 |
except HfHubHTTPError:
|
18 |
has_discussion = True
|
19 |
title = f"## Memory usage for '{model_name}'"
|
20 |
-
data = calculate_memory(
|
21 |
return [title, gr.update(visible=True, value=pd.DataFrame(data)), gr.update(visible=not has_discussion)]
|
22 |
|
23 |
|
|
|
5 |
from huggingface_hub.utils import HfHubHTTPError
|
6 |
|
7 |
|
|
|
|
|
|
|
|
|
8 |
def get_results(model_name: str, library: str, options: list, access_token: str):
|
9 |
+
model = get_model(model_name, library, access_token)
|
|
|
10 |
try:
|
11 |
has_discussion = check_for_discussion(model_name)
|
12 |
except HfHubHTTPError:
|
13 |
has_discussion = True
|
14 |
title = f"## Memory usage for '{model_name}'"
|
15 |
+
data = calculate_memory(model, options)
|
16 |
return [title, gr.update(visible=True, value=pd.DataFrame(data)), gr.update(visible=not has_discussion)]
|
17 |
|
18 |
|