raj-vir-singh
commited on
Commit
•
5f10640
1
Parent(s):
3d69e25
Update app.py
Browse files
app.py
CHANGED
@@ -2,14 +2,13 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import torch
|
4 |
from transformers import RobertaTokenizer, T5ForConditionalGeneration
|
5 |
-
access_token = os.environ.get("access_token") or True
|
6 |
|
7 |
model_name = "ThoughtFocusAI/CodeGeneration-CodeT5-small"
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
model = T5ForConditionalGeneration.from_pretrained(
|
10 |
-
model_name
|
11 |
tokenizer = RobertaTokenizer.from_pretrained(
|
12 |
-
model_name
|
13 |
|
14 |
|
15 |
def generate_code(user_input):
|
|
|
2 |
import os
|
3 |
import torch
|
4 |
from transformers import RobertaTokenizer, T5ForConditionalGeneration
|
|
|
5 |
|
6 |
model_name = "ThoughtFocusAI/CodeGeneration-CodeT5-small"
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
model = T5ForConditionalGeneration.from_pretrained(
|
9 |
+
model_name).to(device)
|
10 |
tokenizer = RobertaTokenizer.from_pretrained(
|
11 |
+
model_name)
|
12 |
|
13 |
|
14 |
def generate_code(user_input):
|