Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import gradio as gr #Web interface
|
| 2 |
-
from transformers import
|
| 3 |
model_name="Salesforce/codegen-350M-multi"
|
| 4 |
|
| 5 |
#Initialize the tokenizer and model
|
| 6 |
tokenizer=AutoTokenizer.from_pretrained(model_name)
|
| 7 |
-
model=
|
| 8 |
|
| 9 |
def generate_code(prompt, max_length=100, temperature=0.7, top_p=0.95):
|
| 10 |
inputs=tokenizer(prompt,return_tensors='pt')
|
|
|
|
| 1 |
import gradio as gr #Web interface
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer #For loading the model and making the input into tokens
|
| 3 |
model_name="Salesforce/codegen-350M-multi"
|
| 4 |
|
| 5 |
#Initialize the tokenizer and model
|
| 6 |
tokenizer=AutoTokenizer.from_pretrained(model_name)
|
| 7 |
+
model=AutoModelForCausalLM.from_pretrained(model_name)
|
| 8 |
|
| 9 |
def generate_code(prompt, max_length=100, temperature=0.7, top_p=0.95):
|
| 10 |
inputs=tokenizer(prompt,return_tensors='pt')
|