karthik18AI commited on
Commit
941dc55
·
verified ·
1 Parent(s): 2e94e36
Files changed (1) hide show
  1. app.py +24 -12
app.py CHANGED
@@ -4,20 +4,32 @@ model_name = "microsoft/codereviewer"
4
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
5
  tokenizer = AutoTokenizer.from_pretrained(model_name)
6
 
7
- # Example C# code snippet with more detailed context
8
  code_snippet = """
9
- // This class demonstrates a simple HelloWorld program
10
- public class HelloWorld {
11
- // Main method
12
- // This method is the entry point of the program
13
- public static async Task Main(string[] args) {
14
- try {
15
- // Print Hello, World! to the console
16
- Console.WriteLine("Hello, World!");
17
- } catch (Exception ex) {
18
- // Log any exceptions that occur
19
- Console.WriteLine($"An error occurred: {ex.Message}");
 
 
 
 
 
 
 
 
 
 
 
20
  }
 
21
  }
22
  }
23
  """
 
4
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
5
  tokenizer = AutoTokenizer.from_pretrained(model_name)
6
 
7
+ # More complex C# code snippet
8
  code_snippet = """
9
+ // This class demonstrates a simple calculator program
10
+ public class Calculator {
11
+ // Adds two integers
12
+ public int Add(int a, int b) {
13
+ return a + b;
14
+ }
15
+
16
+ // Subtracts second integer from first
17
+ public int Subtract(int a, int b) {
18
+ return a - b;
19
+ }
20
+
21
+ // Multiplies two integers
22
+ public int Multiply(int a, int b) {
23
+ return a * b;
24
+ }
25
+
26
+ // Divides first integer by second
27
+ // Throws DivideByZeroException if b is zero
28
+ public int Divide(int a, int b) {
29
+ if (b == 0) {
30
+ throw new DivideByZeroException("Division by zero is not allowed.");
31
  }
32
+ return a / b;
33
  }
34
  }
35
  """