Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -12,6 +12,13 @@ model_name = "soynade-research/Oolel-v0.1"
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
13 |
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Fonction pour générer une réponse
|
16 |
@spaces.GPU(duration=120)
|
17 |
def generate_response(user_input, system_prompt, max_new_tokens=150, temperature=0.7):
|
@@ -35,12 +42,17 @@ iface = gr.Interface(
|
|
35 |
fn=generate_response,
|
36 |
inputs=[
|
37 |
gr.Textbox(label="Message utilisateur", placeholder="Entrez votre message ici..."),
|
38 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
39 |
gr.Slider(50, 500, value=150, label="Nombre max de tokens")
|
40 |
],
|
41 |
outputs="text",
|
42 |
title="Oolel Chatbot",
|
43 |
-
description="Entrez votre message et
|
44 |
)
|
45 |
|
46 |
# Lancer l'interface
|
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
13 |
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
14 |
|
15 |
+
# Liste des prompts système prédéfinis
|
16 |
+
system_prompts = {
|
17 |
+
"Conte Wolof traditionnel": "You are a skilled Wolof storyteller (Gewël) with deep knowledge of African folktales and traditions. Write engaging stories in Wolof that reflect African cultural values and wisdom.",
|
18 |
+
"Conseils en développement": "You are a software developer with expertise in building applications. Provide practical advice and solutions for coding challenges in Python and machine learning.",
|
19 |
+
"Conseils en gestion de projet": "You are an expert in project management, capable of offering insights on how to efficiently manage a remote development team and keep them motivated."
|
20 |
+
}
|
21 |
+
|
22 |
# Fonction pour générer une réponse
|
23 |
@spaces.GPU(duration=120)
|
24 |
def generate_response(user_input, system_prompt, max_new_tokens=150, temperature=0.7):
|
|
|
42 |
fn=generate_response,
|
43 |
inputs=[
|
44 |
gr.Textbox(label="Message utilisateur", placeholder="Entrez votre message ici..."),
|
45 |
+
gr.Dropdown(
|
46 |
+
label="Choisir un prompt système",
|
47 |
+
choices=list(system_prompts.keys()), # Liste des options de prompts
|
48 |
+
value="Conte Wolof traditionnel", # Valeur par défaut
|
49 |
+
type="value"
|
50 |
+
),
|
51 |
gr.Slider(50, 500, value=150, label="Nombre max de tokens")
|
52 |
],
|
53 |
outputs="text",
|
54 |
title="Oolel Chatbot",
|
55 |
+
description="Entrez votre message et choisissez un prompt pour générer des réponses adaptées dans divers domaines."
|
56 |
)
|
57 |
|
58 |
# Lancer l'interface
|