Spaces:
Runtime error
Runtime error
ganesh123dsa
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
-
|
2 |
-
pip install transformers
|
3 |
-
|
4 |
from huggingface_hub import login
|
5 |
-
login(" ")
|
6 |
-
|
7 |
-
pip install gradio transformers torch
|
8 |
-
|
9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
10 |
|
11 |
-
#
|
|
|
|
|
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen-350M-multi")
|
13 |
model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen-350M-multi")
|
14 |
|
@@ -29,4 +28,5 @@ generated_ids = model.generate(
|
|
29 |
# Decode the generated tokens to text
|
30 |
generated_code = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
|
31 |
|
32 |
-
|
|
|
|
1 |
+
# Install required libraries
|
2 |
+
pip install transformers huggingface_hub gradio torch
|
3 |
+
# Import necessary modules
|
4 |
from huggingface_hub import login
|
|
|
|
|
|
|
|
|
5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
6 |
|
7 |
+
# Log in to Hugging Face (replace 'your_token' with your actual Hugging Face token)
|
8 |
+
login("your_huggingface_token")
|
9 |
+
|
10 |
+
# Load the tokenizer and model from Hugging Face
|
11 |
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen-350M-multi")
|
12 |
model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen-350M-multi")
|
13 |
|
|
|
28 |
# Decode the generated tokens to text
|
29 |
generated_code = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
|
30 |
|
31 |
+
# Output the generated code
|
32 |
+
print(generated_code)
|