Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,9 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
-
# Load model and tokenizer
|
5 |
-
|
6 |
-
model = AutoModelForCausalLM.from_pretrained(
|
7 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
|
9 |
# Define function to translate code
|
10 |
def translate_code(input_code, prompt=""):
|
@@ -26,4 +25,4 @@ gr.Interface(
|
|
26 |
title="AI Code Translator",
|
27 |
description="Translate your code using Meta-Llama-3-8B model.",
|
28 |
theme="compact"
|
29 |
-
).launch()
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
+
# Load model and tokenizer directly
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B")
|
6 |
+
model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B")
|
|
|
7 |
|
8 |
# Define function to translate code
|
9 |
def translate_code(input_code, prompt=""):
|
|
|
25 |
title="AI Code Translator",
|
26 |
description="Translate your code using Meta-Llama-3-8B model.",
|
27 |
theme="compact"
|
28 |
+
).launch()
|