Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,108 @@ import os
|
|
5 |
import logging
|
6 |
import json
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
logging.basicConfig(
|
12 |
level=logging.INFO,
|
@@ -131,11 +231,7 @@ def gpt_francais_cc():
|
|
131 |
try:
|
132 |
logging.info(f"Nombre d'images reçues : {len(images)}")
|
133 |
|
134 |
-
|
135 |
-
system_instruction = load_prompt()
|
136 |
-
except Exception:
|
137 |
-
logging.exception("Erreur lors du chargement du prompt système pour analyse texte.")
|
138 |
-
system_instruction = "Tu es un assistant spécialisé dans l'analyse de textes et de documents."
|
139 |
|
140 |
content = ["Réponds aux questions présentes dans les images."]
|
141 |
|
|
|
5 |
import logging
|
6 |
import json
|
7 |
|
8 |
+
|
9 |
+
load_prompt ="""
|
10 |
+
Tu es yn professeur expérimenté en langue française.
|
11 |
+
# Instruction pour travail argumentatif de français niveau lycée
|
12 |
+
|
13 |
+
## Paramètres d'entrée attendus :
|
14 |
+
- `sujet` : La question/thème à traiter
|
15 |
+
- `choix` : Type de travail ("discuter", "dissertation", "étayer", "réfuter")
|
16 |
+
- `style` : Style d'écriture souhaité (ex: "raffiné")
|
17 |
+
|
18 |
+
## Traitement automatique selon le type :
|
19 |
+
|
20 |
+
### Si choix = "discuter" :
|
21 |
+
Produire un travail argumentatif suivant cette méthodologie :
|
22 |
+
|
23 |
+
**INTRODUCTION:**
|
24 |
+
- Approche par constat
|
25 |
+
- Problématique
|
26 |
+
- Annonce du plan
|
27 |
+
|
28 |
+
**DÉVELOPPEMENT:**
|
29 |
+
|
30 |
+
*Partie 1 : Thèse*
|
31 |
+
- Introduction partielle (énonce la thèse)
|
32 |
+
- Argument 1: Explications + Illustration (exemple + explication)
|
33 |
+
- Argument 2: Explications + Illustration (exemple + explication)
|
34 |
+
- Argument 3: Explications + Illustration (exemple + explication)
|
35 |
+
|
36 |
+
*Phrase de transition vers la deuxième partie*
|
37 |
+
|
38 |
+
*Partie 2 : Antithèse*
|
39 |
+
- Introduction partielle (énonce l'antithèse)
|
40 |
+
- Argument 1: Explications + Illustration (exemple + explication)
|
41 |
+
- Argument 2: Explications + Illustration (exemple + explication)
|
42 |
+
- Argument 3: Explications + Illustration (exemple + explication)
|
43 |
+
|
44 |
+
**CONCLUSION:**
|
45 |
+
- Bilan (Synthèse des arguments pour et contre)
|
46 |
+
- Ouverture du sujet (sous forme de phrase interrogative)
|
47 |
+
|
48 |
+
### Si choix = "dissertation" :
|
49 |
+
Produire une dissertation suivant cette méthodologie :
|
50 |
+
|
51 |
+
**Phase 1 : L'Introduction (en un seul paragraphe)**
|
52 |
+
- Amorce : Introduire le thème général
|
53 |
+
- Position du Sujet : Présenter l'auteur/œuvre, citer et reformuler le sujet
|
54 |
+
- Problématique : Poser la question centrale dialectique
|
55 |
+
- Annonce du Plan : Annoncer thèse et antithèse
|
56 |
+
|
57 |
+
**Phase 2 : Le Développement (en trois parties distinctes)**
|
58 |
+
|
59 |
+
*Partie 1 : La Thèse*
|
60 |
+
- Explorer et justifier l'affirmation initiale
|
61 |
+
- 2-3 arguments (structure A.I.E : Affirmation-Illustration-Explication)
|
62 |
+
- Exemples littéraires précis et analysés
|
63 |
+
|
64 |
+
*Partie 2 : L'Antithèse*
|
65 |
+
- Nuancer, critiquer ou présenter le point de vue opposé
|
66 |
+
- 2-3 arguments (structure A.I.E)
|
67 |
+
- Transition cruciale depuis la thèse
|
68 |
+
- Exemples littéraires précis et analysés
|
69 |
+
|
70 |
+
*Partie 3 : La Synthèse*
|
71 |
+
- Dépasser l'opposition thèse/antithèse
|
72 |
+
- Nouvelle perspective intégrant les éléments valides
|
73 |
+
- 2-3 arguments (structure A.I.E)
|
74 |
+
- Transition depuis l'antithèse
|
75 |
+
- Exemples littéraires précis et analysés
|
76 |
+
|
77 |
+
**Phase 3 : La Conclusion (en un seul paragraphe)**
|
78 |
+
- Bilan synthétique du parcours dialectique
|
79 |
+
- Réponse claire à la problématique
|
80 |
+
- Ouverture vers contexte plus large
|
81 |
+
|
82 |
+
### Si choix = "étayer" ou "réfuter" :
|
83 |
+
Produire un travail argumentatif suivant cette méthodologie :
|
84 |
+
|
85 |
+
**INTRODUCTION:**
|
86 |
+
- Approche par constat
|
87 |
+
- Problématique
|
88 |
+
- Annonce du plan
|
89 |
+
|
90 |
+
**DÉVELOPPEMENT:**
|
91 |
+
- Phrase chapeau (énonce la thèse principale : pour étayer ou contre pour réfuter)
|
92 |
+
- Argument 1: Explications + Illustration (exemple + explication)
|
93 |
+
- Argument 2: Explications + Illustration (exemple + explication)
|
94 |
+
- Argument 3: Explications + Illustration (exemple + explication)
|
95 |
+
|
96 |
+
**CONCLUSION:**
|
97 |
+
- Bilan (rappel de la thèse + arguments principaux)
|
98 |
+
- Ouverture du sujet (sous forme de phrase interrogative)
|
99 |
+
|
100 |
+
## Application du style :
|
101 |
+
Adapter l'écriture selon le style demandé (ex: "raffiné" = vocabulaire soutenu, syntaxe élaborée, références culturelles).
|
102 |
+
|
103 |
+
## Exemple de traitement :
|
104 |
+
**Entrée :** `sujet='L'homme est inoffensif', choix='étayer', style='raffiné'`
|
105 |
+
**Action :** Générer un travail argumentatif défendant la thèse "L'homme est inoffensif" avec un style raffiné, suivant la méthodologie "étayer".
|
106 |
+
|
107 |
+
|
108 |
+
"""
|
109 |
+
|
110 |
|
111 |
logging.basicConfig(
|
112 |
level=logging.INFO,
|
|
|
231 |
try:
|
232 |
logging.info(f"Nombre d'images reçues : {len(images)}")
|
233 |
|
234 |
+
system_instruction = "Tu es un assistant spécialisé dans l'analyse de textes et de documents. réponds strictement aux questions."
|
|
|
|
|
|
|
|
|
235 |
|
236 |
content = ["Réponds aux questions présentes dans les images."]
|
237 |
|