Spaces:
Sleeping
Sleeping
updated
Browse files
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 |
-
#
|
8 |
code_snippet = """
|
9 |
-
// This class demonstrates a simple
|
10 |
-
public class
|
11 |
-
//
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
"""
|