Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,49 @@ st.markdown("yup")
|
|
| 12 |
# Configuration de l'API Gemini
|
| 13 |
api_key = os.environ["GEMINI_API_KEY"]
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
genai.configure(api_key=api_key)
|
| 16 |
safety_settings = [
|
| 17 |
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"},
|
|
@@ -53,6 +96,49 @@ uploaded_files = load_pdf_files()
|
|
| 53 |
def process_input(prompt, image_file):
|
| 54 |
"""Traite le texte et l'image optionnelle et génère une réponse."""
|
| 55 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# Préparer le contenu en ajoutant tous les fichiers PDF
|
| 57 |
print(prompt)
|
| 58 |
content = uploaded_files.copy()
|
|
@@ -70,7 +156,7 @@ def process_input(prompt, image_file):
|
|
| 70 |
|
| 71 |
# Ajout du prompt avec l'instruction de répondre en français
|
| 72 |
content.append("\n\n")
|
| 73 |
-
content.append(
|
| 74 |
|
| 75 |
# Génération du contenu
|
| 76 |
with st.spinner("Génération de la réponse..."):
|
|
|
|
| 12 |
# Configuration de l'API Gemini
|
| 13 |
api_key = os.environ["GEMINI_API_KEY"]
|
| 14 |
|
| 15 |
+
methodologie = f"""
|
| 16 |
+
Traite ce sujet de philosophie "{phi_prompt}" selon le plan suivant.commence directement ta réponse par introduction :
|
| 17 |
+
:
|
| 18 |
+
|
| 19 |
+
# INTRODUCTION: ( l'introduction se fait en un paragraphe)
|
| 20 |
+
- Approche par constat
|
| 21 |
+
- Posez la citation
|
| 22 |
+
- Reformulation de la citation
|
| 23 |
+
- Nuancez la thèse (antithèse)
|
| 24 |
+
- De cette opposition naît le problème
|
| 25 |
+
- En quoi
|
| 26 |
+
- Idée de la citation
|
| 27 |
+
|
| 28 |
+
# DÉVELOPPEMENT:
|
| 29 |
+
## Première partie (Thèse)
|
| 30 |
+
- Introduction partielle (thèse + arguments1 + arguments2)
|
| 31 |
+
- Argument 1:
|
| 32 |
+
* Explications
|
| 33 |
+
* Illustration (citation + reformulation)
|
| 34 |
+
- Argument 2:
|
| 35 |
+
* Explications
|
| 36 |
+
* Illustration (exemple + explication)
|
| 37 |
+
- Transition:
|
| 38 |
+
* Bilan (thèse + arguments1 + arguments2)
|
| 39 |
+
* Annonce de l'idée critique
|
| 40 |
+
|
| 41 |
+
## Deuxième partie (Antithèse)
|
| 42 |
+
- Introduction partielle (antithèse + arguments3 + arguments4)
|
| 43 |
+
- Argument 3:
|
| 44 |
+
* Explications
|
| 45 |
+
* Illustration (citation + reformulation)
|
| 46 |
+
- Argument 4:
|
| 47 |
+
* Explications
|
| 48 |
+
* Illustration (exemple + reformulation)
|
| 49 |
+
|
| 50 |
+
# CONCLUSION:
|
| 51 |
+
- Bilan global de l'analyse (rappel du problème + thèse + antithèse)
|
| 52 |
+
- Prise de position (réponse à la question critique de l'introduction)
|
| 53 |
+
|
| 54 |
+
Je veux un travail bien détaillé et complet avec un français raffiné et soutenu.
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
|
| 58 |
genai.configure(api_key=api_key)
|
| 59 |
safety_settings = [
|
| 60 |
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"},
|
|
|
|
| 96 |
def process_input(prompt, image_file):
|
| 97 |
"""Traite le texte et l'image optionnelle et génère une réponse."""
|
| 98 |
try:
|
| 99 |
+
|
| 100 |
+
methodologie = f"""
|
| 101 |
+
Traite ce sujet de philosophie "{prompt}" selon le plan suivant.commence directement ta réponse par introduction :
|
| 102 |
+
:
|
| 103 |
+
|
| 104 |
+
# INTRODUCTION: ( l'introduction se fait en un paragraphe)
|
| 105 |
+
- Approche par constat
|
| 106 |
+
- Posez la citation
|
| 107 |
+
- Reformulation de la citation
|
| 108 |
+
- Nuancez la thèse (antithèse)
|
| 109 |
+
- De cette opposition naît le problème
|
| 110 |
+
- En quoi
|
| 111 |
+
- Idée de la citation
|
| 112 |
+
|
| 113 |
+
# DÉVELOPPEMENT:
|
| 114 |
+
## Première partie (Thèse)
|
| 115 |
+
- Introduction partielle (thèse + arguments1 + arguments2)
|
| 116 |
+
- Argument 1:
|
| 117 |
+
* Explications
|
| 118 |
+
* Illustration (citation + reformulation)
|
| 119 |
+
- Argument 2:
|
| 120 |
+
* Explications
|
| 121 |
+
* Illustration (exemple + explication)
|
| 122 |
+
- Transition:
|
| 123 |
+
* Bilan (thèse + arguments1 + arguments2)
|
| 124 |
+
* Annonce de l'idée critique
|
| 125 |
+
|
| 126 |
+
## Deuxième partie (Antithèse)
|
| 127 |
+
- Introduction partielle (antithèse + arguments3 + arguments4)
|
| 128 |
+
- Argument 3:
|
| 129 |
+
* Explications
|
| 130 |
+
* Illustration (citation + reformulation)
|
| 131 |
+
- Argument 4:
|
| 132 |
+
* Explications
|
| 133 |
+
* Illustration (exemple + reformulation)
|
| 134 |
+
|
| 135 |
+
# CONCLUSION:
|
| 136 |
+
- Bilan global de l'analyse (rappel du problème + thèse + antithèse)
|
| 137 |
+
- Prise de position (réponse à la question critique de l'introduction)
|
| 138 |
+
|
| 139 |
+
Je veux un travail bien détaillé et complet avec un français raffiné et soutenu.
|
| 140 |
+
base toi sur les fichiers fournis.
|
| 141 |
+
"""
|
| 142 |
# Préparer le contenu en ajoutant tous les fichiers PDF
|
| 143 |
print(prompt)
|
| 144 |
content = uploaded_files.copy()
|
|
|
|
| 156 |
|
| 157 |
# Ajout du prompt avec l'instruction de répondre en français
|
| 158 |
content.append("\n\n")
|
| 159 |
+
content.append(methodologie)
|
| 160 |
|
| 161 |
# Génération du contenu
|
| 162 |
with st.spinner("Génération de la réponse..."):
|