tharun1507 commited on
Commit
25822d3
·
verified ·
1 Parent(s): b391d67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -2
app.py CHANGED
@@ -30,7 +30,7 @@ def get_completion(code_snippet):
30
  modify_list(my_list)
31
  print(my_list)
32
  Correct output: [0, 4]
33
- Explanation: input_list is modified by appending 4, but the reassignment does not affect the original list.
34
 
35
  ---------------------
36
  Example 3:
@@ -38,6 +38,31 @@ def get_completion(code_snippet):
38
  Correct output: hello
39
  Explanation: This line outputs the string 'hello' to the console.
40
  ---------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  """
42
 
43
  prompt = f"""
@@ -52,7 +77,7 @@ def get_completion(code_snippet):
52
 
53
  try:
54
  print("Generating text...")
55
- response = text_generator(prompt, max_length=300, num_return_sequences=1)
56
  print("Text generation complete.")
57
  return response[0]['generated_text']
58
  except Exception as e:
 
30
  modify_list(my_list)
31
  print(my_list)
32
  Correct output: [0, 4]
33
+ Explanation: The function appends 4 to input_list, which modifies my_list directly. The reassignment does not affect the original list.
34
 
35
  ---------------------
36
  Example 3:
 
38
  Correct output: hello
39
  Explanation: This line outputs the string 'hello' to the console.
40
  ---------------------
41
+ Example 4:
42
+ for i in range(5):
43
+ print(i)
44
+ Correct output:
45
+ 0
46
+ 1
47
+ 2
48
+ 3
49
+ 4
50
+ Explanation: This loop iterates from 0 to 4, printing each number on a new line.
51
+ ---------------------
52
+ Example 5:
53
+ def add(a, b):
54
+ return a + b
55
+ result = add(3, 4)
56
+ print(result)
57
+ Correct output: 7
58
+ Explanation: The function add takes two arguments, adds them together, and returns the result. print(result) outputs 7.
59
+ ---------------------
60
+ Example 6:
61
+ if True:
62
+ print("This is true")
63
+ Correct output: This is true
64
+ Explanation: The condition True always evaluates to True, so the print statement is executed.
65
+ ---------------------
66
  """
67
 
68
  prompt = f"""
 
77
 
78
  try:
79
  print("Generating text...")
80
+ response = text_generator(prompt, max_new_tokens=100, num_return_sequences=1)
81
  print("Text generation complete.")
82
  return response[0]['generated_text']
83
  except Exception as e: