Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -415,8 +415,16 @@ La conclusion répond à la question critique posée en introduction, en s'appuy
|
|
| 415 |
#model = genai.GenerativeModel(model_name="models/gemini-2.0-flash-exp", safety_settings=safety_settings)
|
| 416 |
#response = model.generate_content(prompt, request_options={"timeout": 1100})
|
| 417 |
|
| 418 |
-
dissertation = response.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
return jsonify({"response": dissertation}), 200
|
|
|
|
|
|
|
| 420 |
except Exception as e:
|
| 421 |
print(f"Erreur dans la génération de contenu : {e}")
|
| 422 |
return jsonify({"error": "error"}), 500
|
|
|
|
| 415 |
#model = genai.GenerativeModel(model_name="models/gemini-2.0-flash-exp", safety_settings=safety_settings)
|
| 416 |
#response = model.generate_content(prompt, request_options={"timeout": 1100})
|
| 417 |
|
| 418 |
+
#dissertation = response.text
|
| 419 |
+
#return jsonify({"response": dissertation}), 200
|
| 420 |
+
|
| 421 |
+
dissertation = ""
|
| 422 |
+
for part in response.candidates[0].content.parts:
|
| 423 |
+
if not part.thought:
|
| 424 |
+
dissertation += part.text
|
| 425 |
return jsonify({"response": dissertation}), 200
|
| 426 |
+
|
| 427 |
+
|
| 428 |
except Exception as e:
|
| 429 |
print(f"Erreur dans la génération de contenu : {e}")
|
| 430 |
return jsonify({"error": "error"}), 500
|