Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -211,23 +211,44 @@ def prime_factors(n):
|
|
211 |
""",
|
212 |
"""
|
213 |
import numpy
|
214 |
-
|
215 |
return np.dot(A, B)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
"""
|
217 |
]
|
218 |
example = examples[0]
|
219 |
|
220 |
with gr.Blocks() as demo:
|
221 |
gr.Markdown("<h1><center>Llama_test: generate unit test for your Python code</center></h1>")
|
222 |
-
code_input = gr.Code(example, label="Provide the code of the function you want to test")
|
223 |
gr.Examples(
|
224 |
examples=examples,
|
225 |
inputs=code_input,)
|
226 |
|
227 |
generate_btn = gr.Button("Generate test")
|
228 |
with gr.Row():
|
229 |
-
code_output = gr.Code(label="Passed tests")
|
230 |
-
code_output2 = gr.Code(label="Failed tests")
|
231 |
|
232 |
generate_btn.click(main, inputs=code_input, outputs=[code_output, code_output2])
|
233 |
if __name__ == "__main__":
|
|
|
211 |
""",
|
212 |
"""
|
213 |
import numpy
|
214 |
+
def matrix_multiplication(A, B):
|
215 |
return np.dot(A, B)
|
216 |
+
""",
|
217 |
+
"""
|
218 |
+
import numpy as np
|
219 |
+
|
220 |
+
def efficient_is_semipositive_definite(matrix):
|
221 |
+
try:
|
222 |
+
# Attempt Cholesky decomposition
|
223 |
+
np.linalg.cholesky(matrix)
|
224 |
+
return True
|
225 |
+
except np.linalg.LinAlgError:
|
226 |
+
return False
|
227 |
+
""",
|
228 |
+
"""
|
229 |
+
import numpy as np
|
230 |
+
|
231 |
+
def is_semipositive_definite(matrix):
|
232 |
+
# Compute the eigenvalues of the matrix
|
233 |
+
eigenvalues = np.linalg.eigvals(matrix)
|
234 |
+
|
235 |
+
# Check if all eigenvalues are non-negative
|
236 |
+
return all(val >= 0 for val in eigenvalues)
|
237 |
"""
|
238 |
]
|
239 |
example = examples[0]
|
240 |
|
241 |
with gr.Blocks() as demo:
|
242 |
gr.Markdown("<h1><center>Llama_test: generate unit test for your Python code</center></h1>")
|
243 |
+
code_input = gr.Code(example, language="python", label="Provide the code of the function you want to test")
|
244 |
gr.Examples(
|
245 |
examples=examples,
|
246 |
inputs=code_input,)
|
247 |
|
248 |
generate_btn = gr.Button("Generate test")
|
249 |
with gr.Row():
|
250 |
+
code_output = gr.Code(language="python", label="Passed tests")
|
251 |
+
code_output2 = gr.Code(language="python", label="Failed tests")
|
252 |
|
253 |
generate_btn.click(main, inputs=code_input, outputs=[code_output, code_output2])
|
254 |
if __name__ == "__main__":
|