Spaces:
Sleeping
Sleeping
fix code5t error
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# app.py - CodeLab Stage 3: Semantic Analysis - Fixed Version
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
-
from transformers import AutoTokenizer, AutoModel, T5ForConditionalGeneration
|
| 5 |
import json
|
| 6 |
import re
|
| 7 |
import ast
|
|
@@ -25,10 +25,10 @@ class SemanticAnalyzer:
|
|
| 25 |
logger.info("π Loading CodeBERT...")
|
| 26 |
self.codebert_tokenizer = AutoTokenizer.from_pretrained("microsoft/codebert-base")
|
| 27 |
self.codebert_model = AutoModel.from_pretrained("microsoft/codebert-base")
|
| 28 |
-
|
| 29 |
# CodeT5 for code analysis and generation
|
| 30 |
logger.info("π§ Loading CodeT5...")
|
| 31 |
-
self.codet5_tokenizer =
|
| 32 |
self.codet5_model = T5ForConditionalGeneration.from_pretrained("Salesforce/codet5-base")
|
| 33 |
|
| 34 |
# Set models to eval mode for inference
|
|
|
|
| 1 |
# app.py - CodeLab Stage 3: Semantic Analysis - Fixed Version
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
+
from transformers import AutoTokenizer, AutoModel, T5ForConditionalGeneration
|
| 5 |
import json
|
| 6 |
import re
|
| 7 |
import ast
|
|
|
|
| 25 |
logger.info("π Loading CodeBERT...")
|
| 26 |
self.codebert_tokenizer = AutoTokenizer.from_pretrained("microsoft/codebert-base")
|
| 27 |
self.codebert_model = AutoModel.from_pretrained("microsoft/codebert-base")
|
| 28 |
+
|
| 29 |
# CodeT5 for code analysis and generation
|
| 30 |
logger.info("π§ Loading CodeT5...")
|
| 31 |
+
self.codet5_tokenizer = AutoTokenizer.from_pretrained("Salesforce/codet5-base") # β
|
| 32 |
self.codet5_model = T5ForConditionalGeneration.from_pretrained("Salesforce/codet5-base")
|
| 33 |
|
| 34 |
# Set models to eval mode for inference
|