Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,12 +97,27 @@ def generate_docstring(code: str) -> str:
|
|
97 |
# --- Gradio UI ---
|
98 |
iface = gr.Interface(
|
99 |
fn=generate_docstring,
|
100 |
-
inputs=gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
outputs=gr.Textbox(label="Generated Docstring"),
|
102 |
title="Code-to-Docstring Generator (Shuu12121/CodeEncoderDecoderModel-Ghost)",
|
103 |
description="This demo uses the Shuu12121/CodeEncoderDecoderModel-Ghost model to automatically generate Python docstrings from code snippets. Paste your code below and click 'Submit'."
|
104 |
)
|
105 |
|
|
|
106 |
# --- アプリケーションの起動 ---
|
107 |
# Hugging Face Spacesで実行する場合、share=Trueは不要
|
108 |
if __name__ == "__main__":
|
|
|
97 |
# --- Gradio UI ---
|
98 |
iface = gr.Interface(
|
99 |
fn=generate_docstring,
|
100 |
+
inputs=gr.Textbox(
|
101 |
+
label="Code Snippet",
|
102 |
+
lines=10,
|
103 |
+
placeholder="Paste your Python function or code block here...",
|
104 |
+
value="""public static String readFileToString(File file, Charset encoding) throws IOException {
|
105 |
+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding))) {
|
106 |
+
StringBuilder sb = new StringBuilder();
|
107 |
+
String line;
|
108 |
+
while ((line = reader.readLine()) != null) {
|
109 |
+
sb.append(line).append("\\n");
|
110 |
+
}
|
111 |
+
return sb.toString();
|
112 |
+
}
|
113 |
+
}"""
|
114 |
+
),
|
115 |
outputs=gr.Textbox(label="Generated Docstring"),
|
116 |
title="Code-to-Docstring Generator (Shuu12121/CodeEncoderDecoderModel-Ghost)",
|
117 |
description="This demo uses the Shuu12121/CodeEncoderDecoderModel-Ghost model to automatically generate Python docstrings from code snippets. Paste your code below and click 'Submit'."
|
118 |
)
|
119 |
|
120 |
+
|
121 |
# --- アプリケーションの起動 ---
|
122 |
# Hugging Face Spacesで実行する場合、share=Trueは不要
|
123 |
if __name__ == "__main__":
|