Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from sentence_transformers import SentenceTransformer
|
4 |
from torch.nn.functional import cosine_similarity
|
|
|
5 |
|
6 |
# モデルの読み込み
|
7 |
model = SentenceTransformer("Shuu12121/CodeCloneDetection-ModernBERT-Owl")
|
@@ -10,7 +11,7 @@ model.eval()
|
|
10 |
# 閾値設定(安定性の高い0.9推奨)
|
11 |
THRESHOLD = 0.9
|
12 |
|
13 |
-
|
14 |
def detect_clone(code1, code2):
|
15 |
if not code1.strip() or not code2.strip():
|
16 |
return "❌ どちらのコードも入力してください", ""
|
|
|
2 |
import torch
|
3 |
from sentence_transformers import SentenceTransformer
|
4 |
from torch.nn.functional import cosine_similarity
|
5 |
+
from spaces import GPU
|
6 |
|
7 |
# モデルの読み込み
|
8 |
model = SentenceTransformer("Shuu12121/CodeCloneDetection-ModernBERT-Owl")
|
|
|
11 |
# 閾値設定(安定性の高い0.9推奨)
|
12 |
THRESHOLD = 0.9
|
13 |
|
14 |
+
@GPU
|
15 |
def detect_clone(code1, code2):
|
16 |
if not code1.strip() or not code2.strip():
|
17 |
return "❌ どちらのコードも入力してください", ""
|