Spaces:
Runtime error
Runtime error
add tree examples
Browse files
app.py
CHANGED
@@ -110,7 +110,41 @@ real_docstring = r"""
|
|
110 |
:raises DuplicateDocumentError: Exception trigger on duplicate document
|
111 |
:return: None
|
112 |
"""
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
def docgen_func(function_code):
|
115 |
req_data = {"inputs": function_code}
|
116 |
output = query(req_data)
|
@@ -147,7 +181,7 @@ _A model is given the task to generate natural language comments for a programmi
|
|
147 |
For further details, see the [CodeXGLUE](https://github.com/microsoft/CodeXGLUE) benchmark dataset and open challenge for code intelligence.
|
148 |
""",
|
149 |
theme='grass',
|
150 |
-
|
151 |
verbose=True,
|
152 |
# show_tips=True
|
153 |
)
|
|
|
110 |
:raises DuplicateDocumentError: Exception trigger on duplicate document
|
111 |
:return: None
|
112 |
"""
|
113 |
+
|
114 |
+
tree_code = r"""
|
115 |
+
class Tree:
|
116 |
+
def __init__(self):
|
117 |
+
self.val = None
|
118 |
+
self.left = None
|
119 |
+
self.right = None
|
120 |
+
"""
|
121 |
+
|
122 |
+
insert_code = r"""
|
123 |
+
def insert(self, val):
|
124 |
+
if self.val:
|
125 |
+
if val < self.val:
|
126 |
+
if self.left is None:
|
127 |
+
self.left = Tree(val)
|
128 |
+
else:
|
129 |
+
self.left.insert(val)
|
130 |
+
elif val > self.val:
|
131 |
+
if self.right is None:
|
132 |
+
self.right = Tree(val)
|
133 |
+
else:
|
134 |
+
self.right.insert(val)
|
135 |
+
else:
|
136 |
+
self.val = val
|
137 |
+
"""
|
138 |
+
|
139 |
+
display_code = r"""
|
140 |
+
def printValues(self):
|
141 |
+
if self.left:
|
142 |
+
self.left.printValues()
|
143 |
+
print(self.val)
|
144 |
+
if self.right:
|
145 |
+
self.right.printValues()
|
146 |
+
"""
|
147 |
+
|
148 |
def docgen_func(function_code):
|
149 |
req_data = {"inputs": function_code}
|
150 |
output = query(req_data)
|
|
|
181 |
For further details, see the [CodeXGLUE](https://github.com/microsoft/CodeXGLUE) benchmark dataset and open challenge for code intelligence.
|
182 |
""",
|
183 |
theme='grass',
|
184 |
+
examples=[[tree_code],[insert_code],[display_code]],
|
185 |
verbose=True,
|
186 |
# show_tips=True
|
187 |
)
|