dhuynh95 commited on
Commit
cf544db
·
1 Parent(s): 3087bb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -62,7 +62,7 @@ def execute_code(code, test):
62
  output = new_stdout.getvalue()
63
  return output
64
 
65
- example = """
66
  def prime_factors(n):
67
  i = 2
68
  factors = []
@@ -75,12 +75,24 @@ def prime_factors(n):
75
  if n > 1:
76
  factors.append(n)
77
  return factors
78
- """
 
 
 
 
 
 
 
79
 
80
  with gr.Blocks() as demo:
81
  gr.Markdown("<h1><center>Llama_test: generate unit test for your Python code</center></h1>")
82
  with gr.Row():
83
  code_input = gr.Code(example, label="Provide the code of the function you want to test")
 
 
 
 
 
84
  generate_btn = gr.Button("Generate test")
85
  with gr.Row():
86
  code_output = gr.Code()
 
62
  output = new_stdout.getvalue()
63
  return output
64
 
65
+ examples = ["""
66
  def prime_factors(n):
67
  i = 2
68
  factors = []
 
75
  if n > 1:
76
  factors.append(n)
77
  return factors
78
+ """,
79
+ """
80
+ import numpy
81
+ def matrix_multiplication(A, B):
82
+ return np.dot(A, B)
83
+ """
84
+ ]
85
+ example = examples[0]
86
 
87
  with gr.Blocks() as demo:
88
  gr.Markdown("<h1><center>Llama_test: generate unit test for your Python code</center></h1>")
89
  with gr.Row():
90
  code_input = gr.Code(example, label="Provide the code of the function you want to test")
91
+ gr.Examples(
92
+ examples=examples,
93
+ inputs=code_input,
94
+ )
95
+
96
  generate_btn = gr.Button("Generate test")
97
  with gr.Row():
98
  code_output = gr.Code()