Spaces:
Sleeping
Sleeping
Sgridda commited on
Commit ·
2588618
1
Parent(s): 733f0e1
updated
Browse files
main.py
CHANGED
|
@@ -37,6 +37,8 @@ def load_model():
|
|
| 37 |
if model is None:
|
| 38 |
print(f"Loading model: {MODEL_NAME} on device: {DEVICE}...")
|
| 39 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
|
|
|
|
|
|
| 40 |
model = AutoModelForCausalLM.from_pretrained(
|
| 41 |
MODEL_NAME,
|
| 42 |
torch_dtype=torch.float32,
|
|
@@ -173,13 +175,12 @@ def root_html():
|
|
| 173 |
</head>
|
| 174 |
<body>
|
| 175 |
<h1>AI Code Review Service</h1>
|
| 176 |
-
<p class="status">✅ Service is running
|
| 177 |
|
| 178 |
<h2>Available Endpoints:</h2>
|
| 179 |
<div class="endpoint"><strong>GET /health</strong> - Health check</div>
|
| 180 |
<div class="endpoint"><strong>POST /review</strong> - Submit code diff for review</div>
|
| 181 |
<div class="endpoint"><strong>GET /docs</strong> - Interactive API documentation</div>
|
| 182 |
-
<div class="endpoint"><strong>GET /test</strong> - Simple test endpoint</div>
|
| 183 |
|
| 184 |
<h2>Quick Test:</h2>
|
| 185 |
<p><a href="/health">Test Health Endpoint</a></p>
|
|
@@ -187,9 +188,9 @@ def root_html():
|
|
| 187 |
|
| 188 |
<h2>Status:</h2>
|
| 189 |
<ul>
|
| 190 |
-
<li>Mode:
|
| 191 |
-
<li>AI Model:
|
| 192 |
-
<li>Response Time: ~
|
| 193 |
</ul>
|
| 194 |
</body>
|
| 195 |
</html>
|
|
|
|
| 37 |
if model is None:
|
| 38 |
print(f"Loading model: {MODEL_NAME} on device: {DEVICE}...")
|
| 39 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 40 |
+
if tokenizer.pad_token is None:
|
| 41 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 42 |
model = AutoModelForCausalLM.from_pretrained(
|
| 43 |
MODEL_NAME,
|
| 44 |
torch_dtype=torch.float32,
|
|
|
|
| 175 |
</head>
|
| 176 |
<body>
|
| 177 |
<h1>AI Code Review Service</h1>
|
| 178 |
+
<p class="status">✅ Service is running with AI model</p>
|
| 179 |
|
| 180 |
<h2>Available Endpoints:</h2>
|
| 181 |
<div class="endpoint"><strong>GET /health</strong> - Health check</div>
|
| 182 |
<div class="endpoint"><strong>POST /review</strong> - Submit code diff for review</div>
|
| 183 |
<div class="endpoint"><strong>GET /docs</strong> - Interactive API documentation</div>
|
|
|
|
| 184 |
|
| 185 |
<h2>Quick Test:</h2>
|
| 186 |
<p><a href="/health">Test Health Endpoint</a></p>
|
|
|
|
| 188 |
|
| 189 |
<h2>Status:</h2>
|
| 190 |
<ul>
|
| 191 |
+
<li>Mode: AI-Powered</li>
|
| 192 |
+
<li>AI Model: Salesforce/codegen-350M-mono</li>
|
| 193 |
+
<li>Response Time: ~30-35 seconds</li>
|
| 194 |
</ul>
|
| 195 |
</body>
|
| 196 |
</html>
|