Spaces:
Sleeping
Sleeping
fine-tune
Browse files
app.py
CHANGED
|
@@ -4,10 +4,13 @@ model_name = "microsoft/codereviewer"
|
|
| 4 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 5 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 6 |
|
| 7 |
-
# Example C# code snippet
|
| 8 |
code_snippet = """
|
|
|
|
| 9 |
public class HelloWorld {
|
|
|
|
| 10 |
public static Task Main(string[] args) {
|
|
|
|
| 11 |
Console.WriteLine("Hello, World!");
|
| 12 |
}
|
| 13 |
}
|
|
@@ -17,4 +20,4 @@ inputs = tokenizer(code_snippet, return_tensors="pt")
|
|
| 17 |
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 18 |
review = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 19 |
|
| 20 |
-
print("Code Review:", review)
|
|
|
|
| 4 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 5 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 6 |
|
| 7 |
+
# Example C# code snippet with more context
|
| 8 |
code_snippet = """
|
| 9 |
+
// This class demonstrates a simple HelloWorld program
|
| 10 |
public class HelloWorld {
|
| 11 |
+
// Main method
|
| 12 |
public static Task Main(string[] args) {
|
| 13 |
+
// Print Hello, World! to the console
|
| 14 |
Console.WriteLine("Hello, World!");
|
| 15 |
}
|
| 16 |
}
|
|
|
|
| 20 |
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 21 |
review = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 22 |
|
| 23 |
+
print("Code Review:", review)
|