Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import torch
|
| 3 |
from transformers import AutoTokenizer, EncoderDecoderModel
|
| 4 |
import gradio as gr
|
|
|
|
| 5 |
|
| 6 |
# デバイス設定 (Spacesのハードウェア設定に依存)
|
| 7 |
# SpacesでGPUを利用する場合、自動的にCUDAが利用可能になります
|
|
@@ -45,6 +46,7 @@ except Exception as e:
|
|
| 45 |
raise
|
| 46 |
|
| 47 |
# --- Docstring生成関数 ---
|
|
|
|
| 48 |
def generate_docstring(code: str) -> str:
|
| 49 |
print("Received code snippet for docstring generation.") # 関数呼び出しログ
|
| 50 |
if not code:
|
|
|
|
| 2 |
import torch
|
| 3 |
from transformers import AutoTokenizer, EncoderDecoderModel
|
| 4 |
import gradio as gr
|
| 5 |
+
from spaces import GPU
|
| 6 |
|
| 7 |
# デバイス設定 (Spacesのハードウェア設定に依存)
|
| 8 |
# SpacesでGPUを利用する場合、自動的にCUDAが利用可能になります
|
|
|
|
| 46 |
raise
|
| 47 |
|
| 48 |
# --- Docstring生成関数 ---
|
| 49 |
+
@GPU
|
| 50 |
def generate_docstring(code: str) -> str:
|
| 51 |
print("Received code snippet for docstring generation.") # 関数呼び出しログ
|
| 52 |
if not code:
|