Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def get_random_query(lang: str, seed: int = 42):
|
|
20 |
random.seed(seed)
|
21 |
idx = random.randint(0, len(subset) - 1)
|
22 |
sample = subset[idx]
|
23 |
-
return sample["
|
24 |
|
25 |
@GPU
|
26 |
def code_search_demo(lang: str, seed: int):
|
@@ -29,7 +29,7 @@ def code_search_demo(lang: str, seed: int):
|
|
29 |
|
30 |
# ランダムに取得した同一言語の10件の関数とドキュメントを比較対象として選択
|
31 |
candidates = dataset_all.filter(lambda x: x["language"] == lang).shuffle(seed=seed).select(range(10))
|
32 |
-
candidate_texts = [c["
|
33 |
candidate_embeddings = model.encode(candidate_texts, convert_to_tensor=True)
|
34 |
|
35 |
# 類似度計算
|
|
|
20 |
random.seed(seed)
|
21 |
idx = random.randint(0, len(subset) - 1)
|
22 |
sample = subset[idx]
|
23 |
+
return sample["func_code_string"] or "", sample["func_documentation_string"] or ""
|
24 |
|
25 |
@GPU
|
26 |
def code_search_demo(lang: str, seed: int):
|
|
|
29 |
|
30 |
# ランダムに取得した同一言語の10件の関数とドキュメントを比較対象として選択
|
31 |
candidates = dataset_all.filter(lambda x: x["language"] == lang).shuffle(seed=seed).select(range(10))
|
32 |
+
candidate_texts = [c["func_code_string"] or "" for c in candidates]
|
33 |
candidate_embeddings = model.encode(candidate_texts, convert_to_tensor=True)
|
34 |
|
35 |
# 類似度計算
|