Spaces:
Sleeping
Sleeping
Joash
commited on
Commit
·
764b8c8
1
Parent(s):
6f61b4f
Simplify implementation and remove Space SDK dependencies
Browse files- app.py +2 -15
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -8,8 +8,6 @@ from datetime import datetime
|
|
| 8 |
import json
|
| 9 |
from typing import List, Dict
|
| 10 |
import warnings
|
| 11 |
-
from huggingface_hub.spaces import SpaceRuntime, SpaceStage
|
| 12 |
-
from huggingface_hub.spaces.space_sdk import SpaceHardware
|
| 13 |
|
| 14 |
# Filter out CUDA/NVML warnings
|
| 15 |
warnings.filterwarnings('ignore', category=UserWarning)
|
|
@@ -31,13 +29,6 @@ os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
|
|
| 31 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 32 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:512"
|
| 33 |
|
| 34 |
-
# Space configuration
|
| 35 |
-
space_config = {
|
| 36 |
-
"hardware": SpaceHardware.A10G_SMALL,
|
| 37 |
-
"stage": SpaceStage.RUNTIME,
|
| 38 |
-
"runtime": SpaceRuntime.ZEROGPU
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
class Review:
|
| 42 |
def __init__(self, code: str, language: str, suggestions: str):
|
| 43 |
self.code = code
|
|
@@ -228,12 +219,8 @@ Code:
|
|
| 228 |
'Device': str(self.device)
|
| 229 |
}
|
| 230 |
|
| 231 |
-
# Initialize reviewer
|
| 232 |
-
|
| 233 |
-
def create_reviewer():
|
| 234 |
-
return CodeReviewer()
|
| 235 |
-
|
| 236 |
-
reviewer = create_reviewer()
|
| 237 |
|
| 238 |
# Create Gradio interface
|
| 239 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
|
|
| 8 |
import json
|
| 9 |
from typing import List, Dict
|
| 10 |
import warnings
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Filter out CUDA/NVML warnings
|
| 13 |
warnings.filterwarnings('ignore', category=UserWarning)
|
|
|
|
| 29 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 30 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:512"
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
class Review:
|
| 33 |
def __init__(self, code: str, language: str, suggestions: str):
|
| 34 |
self.code = code
|
|
|
|
| 219 |
'Device': str(self.device)
|
| 220 |
}
|
| 221 |
|
| 222 |
+
# Initialize reviewer
|
| 223 |
+
reviewer = CodeReviewer()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
# Create Gradio interface
|
| 226 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
requirements.txt
CHANGED
|
@@ -12,7 +12,7 @@ einops>=0.7.0
|
|
| 12 |
scipy>=1.11.0
|
| 13 |
|
| 14 |
# Hugging Face
|
| 15 |
-
huggingface-hub
|
| 16 |
|
| 17 |
# Utilities
|
| 18 |
python-dotenv>=1.0.0
|
|
|
|
| 12 |
scipy>=1.11.0
|
| 13 |
|
| 14 |
# Hugging Face
|
| 15 |
+
huggingface-hub>=0.20.3
|
| 16 |
|
| 17 |
# Utilities
|
| 18 |
python-dotenv>=1.0.0
|