Spaces:
Build error
Build error
æLtorio
commited on
typo
Browse files
app.py
CHANGED
|
@@ -10,7 +10,14 @@ if os.environ.get('HF_TOKEN') is None:
|
|
| 10 |
hugging_face_model_id = "eltorio/Llama-3.2-3B-appreciation"
|
| 11 |
base_model_path = "meta-llama/Llama-3.2-3B-Instruct"
|
| 12 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
|
|
|
| 13 |
device_desc = f"Cette I.A. fonctionne sur {device} 🚀." if device == torch.device('cuda') else f"🐢 Cette I.A. ne peut pas fonctionner sur {device} 🐢."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
if torch.cuda.is_available():
|
| 16 |
# Determine the device (GPU or CPU) to run the model on
|
|
@@ -61,13 +68,6 @@ if torch.cuda.is_available():
|
|
| 61 |
decoded_sequences = tokenizer.batch_decode(outputs[:, inputs.shape[1]:],skip_special_tokens=True)[0]
|
| 62 |
return decoded_sequences
|
| 63 |
|
| 64 |
-
# Define the title, description, and device description for the Gradio interface
|
| 65 |
-
title = f"Une intelligence artificielle pour écrire des appréciationst <b>tourne sur {device}</b>"
|
| 66 |
-
desc = "Ce modèle vous propose une évaluation automatique."
|
| 67 |
-
|
| 68 |
-
# Define the long description for the Gradio interface
|
| 69 |
-
long_desc = f"Cette démonstration est basée sur le modèle <a href='https://huggingface.co/eltorio/Llama-3.2-3B-appreciation'>Llama-3.2-3B-appreciation</a>, c'est un LLM basé sur Llama 3.2 3B-instruct!<br><b>{device_desc}</b><br> 2024 - Ronan Le Meillat"
|
| 70 |
-
|
| 71 |
# Create a Gradio interface with the infere function and specified title and descriptions
|
| 72 |
autoeval = gr.Interface(fn=infere, inputs=[
|
| 73 |
gr.Radio(
|
|
@@ -84,19 +84,13 @@ if torch.cuda.is_available():
|
|
| 84 |
description=desc, article=long_desc)
|
| 85 |
|
| 86 |
# Launch the Gradio interface and share it
|
| 87 |
-
autoeval.launch(server_name="0.0.0.0",share=
|
| 88 |
else:
|
| 89 |
print("No GPU available")
|
| 90 |
device = torch.device('cpu')
|
| 91 |
def infere(trimestre: str, moyenne_1: float,moyenne_2: float,moyenne_3: float, comportement: float, participation: float, travail: float) -> str:
|
| 92 |
return "No GPU available, please contact me"
|
| 93 |
|
| 94 |
-
title = f"Une intelligence artificielle pour écrire des appréciationst <b>tourne sur {device}</b>"
|
| 95 |
-
desc = "Ce modèle vous propose une évaluation automatique."
|
| 96 |
-
|
| 97 |
-
# Define the long description for the Gradio interface
|
| 98 |
-
long_desc = f"Cette démonstration est basée sur le modèle <a href='https://huggingface.co/eltorio/Llama-3.2-3B-appreciation'>Llama-3.2-3B-appreciation</a>, c'est un LLM basé sur Llama 3.2 3B-instruct!<br><b>{device_desc}</b><br> 2024 - Ronan Le Meillat"
|
| 99 |
-
|
| 100 |
# Create a Gradio interface with the infere function and specified title and descriptions
|
| 101 |
autoeval = gr.Interface(fn=infere, inputs=[
|
| 102 |
gr.Radio(
|
|
@@ -113,4 +107,4 @@ else:
|
|
| 113 |
description=desc, article=long_desc)
|
| 114 |
|
| 115 |
# Launch the Gradio interface and share it
|
| 116 |
-
autoeval.launch(server_name="0.0.0.0",share=
|
|
|
|
| 10 |
hugging_face_model_id = "eltorio/Llama-3.2-3B-appreciation"
|
| 11 |
base_model_path = "meta-llama/Llama-3.2-3B-Instruct"
|
| 12 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 13 |
+
|
| 14 |
device_desc = f"Cette I.A. fonctionne sur {device} 🚀." if device == torch.device('cuda') else f"🐢 Cette I.A. ne peut pas fonctionner sur {device} 🐢."
|
| 15 |
+
# Define the title, description, and device description for the Gradio interface
|
| 16 |
+
title = f"Une intelligence artificielle pour écrire des appréciations et tourne sur {device}"
|
| 17 |
+
desc = "Ce modèle vous propose une évaluation automatique."
|
| 18 |
+
|
| 19 |
+
# Define the long description for the Gradio interface
|
| 20 |
+
long_desc = f"Cette démonstration est basée sur le modèle <a href='https://huggingface.co/eltorio/Llama-3.2-3B-appreciation'>Llama-3.2-3B-appreciation</a>, c'est un LLM basé sur Llama 3.2 3B-instruct!<br><b>{device_desc}</b><br> 2024 - Ronan Le Meillat"
|
| 21 |
|
| 22 |
if torch.cuda.is_available():
|
| 23 |
# Determine the device (GPU or CPU) to run the model on
|
|
|
|
| 68 |
decoded_sequences = tokenizer.batch_decode(outputs[:, inputs.shape[1]:],skip_special_tokens=True)[0]
|
| 69 |
return decoded_sequences
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
# Create a Gradio interface with the infere function and specified title and descriptions
|
| 72 |
autoeval = gr.Interface(fn=infere, inputs=[
|
| 73 |
gr.Radio(
|
|
|
|
| 84 |
description=desc, article=long_desc)
|
| 85 |
|
| 86 |
# Launch the Gradio interface and share it
|
| 87 |
+
autoeval.launch(server_name="0.0.0.0",share=True)
|
| 88 |
else:
|
| 89 |
print("No GPU available")
|
| 90 |
device = torch.device('cpu')
|
| 91 |
def infere(trimestre: str, moyenne_1: float,moyenne_2: float,moyenne_3: float, comportement: float, participation: float, travail: float) -> str:
|
| 92 |
return "No GPU available, please contact me"
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
# Create a Gradio interface with the infere function and specified title and descriptions
|
| 95 |
autoeval = gr.Interface(fn=infere, inputs=[
|
| 96 |
gr.Radio(
|
|
|
|
| 107 |
description=desc, article=long_desc)
|
| 108 |
|
| 109 |
# Launch the Gradio interface and share it
|
| 110 |
+
autoeval.launch(server_name="0.0.0.0",share=True)
|