Spaces:
Runtime error
Runtime error
Configure application file
Browse files- app.py +1 -1
- requirements.txt +2 -2
app.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM # Mengimpor tokeni
|
|
4 |
# 1. Load tokenizer dan model dari HuggingFace Hub
|
5 |
model_name = "wahdie11/text2py2" # Ganti dengan path ke model Anda di HuggingFace Hub
|
6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
8 |
|
9 |
# 2. Definisikan fungsi untuk menghasilkan kode dari input teks
|
10 |
def generate_code(prompt):
|
|
|
4 |
# 1. Load tokenizer dan model dari HuggingFace Hub
|
5 |
model_name = "wahdie11/text2py2" # Ganti dengan path ke model Anda di HuggingFace Hub
|
6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, ignore_mismatched_sizes=True)
|
8 |
|
9 |
# 2. Definisikan fungsi untuk menghasilkan kode dari input teks
|
10 |
def generate_code(prompt):
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
transformers>=4.
|
2 |
-
torch
|
3 |
gradio
|
|
|
1 |
+
transformers>=4.31.0
|
2 |
+
torch>=2.0.0
|
3 |
gradio
|