Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ API_TOKEN = os.getenv("HF_API_TOKEN")
|
|
| 9 |
# Change MODEL_ID to a better model
|
| 10 |
# MODEL_ID = "Salesforce/codet5p-770m" # CodeT5+ (Recommended)
|
| 11 |
# MODEL_ID = "bigcode/starcoder2-15b" # StarCoder2
|
| 12 |
-
MODEL_ID = "Salesforce/
|
| 13 |
# MODEL_ID = "bigcode/starcoder"
|
| 14 |
API_URL = f"https://api-inference.huggingface.co/models/{MODEL_ID}"
|
| 15 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
|
@@ -23,8 +23,8 @@ def translate_code(code_snippet, source_lang, target_lang):
|
|
| 23 |
"parameters": {
|
| 24 |
"max_new_tokens": 150,
|
| 25 |
"temperature": 0.2,
|
| 26 |
-
"top_k": 50
|
| 27 |
-
|
| 28 |
}
|
| 29 |
})
|
| 30 |
|
|
|
|
| 9 |
# Change MODEL_ID to a better model
|
| 10 |
# MODEL_ID = "Salesforce/codet5p-770m" # CodeT5+ (Recommended)
|
| 11 |
# MODEL_ID = "bigcode/starcoder2-15b" # StarCoder2
|
| 12 |
+
MODEL_ID = "Salesforce/CodeT5+" # Code Llama
|
| 13 |
# MODEL_ID = "bigcode/starcoder"
|
| 14 |
API_URL = f"https://api-inference.huggingface.co/models/{MODEL_ID}"
|
| 15 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
|
|
|
| 23 |
"parameters": {
|
| 24 |
"max_new_tokens": 150,
|
| 25 |
"temperature": 0.2,
|
| 26 |
+
"top_k": 50,
|
| 27 |
+
"stop": ["\n\n", "#", "//", "'''"]
|
| 28 |
}
|
| 29 |
})
|
| 30 |
|