Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,10 @@ from markupsafe import Markup
|
|
14 |
from gradio_client import Client,handle_file
|
15 |
from functools import wraps
|
16 |
import os
|
17 |
-
|
|
|
|
|
|
|
18 |
import textwrap
|
19 |
import PIL.Image
|
20 |
from werkzeug.utils import secure_filename
|
@@ -58,8 +61,12 @@ safety_settings = [
|
|
58 |
]
|
59 |
|
60 |
|
61 |
-
genai.configure(api_key=GOOGLE_API_KEY)
|
62 |
|
|
|
|
|
|
|
|
|
63 |
|
64 |
MAX_CONTENT_LENGTH = 760 * 1024 * 1024 # 16MB max file size
|
65 |
|
@@ -399,8 +406,14 @@ La conclusion répond à la question critique posée en introduction, en s'appuy
|
|
399 |
prompt = methodologie
|
400 |
|
401 |
try:
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
dissertation = response.text
|
406 |
return jsonify({"response": dissertation}), 200
|
|
|
14 |
from gradio_client import Client,handle_file
|
15 |
from functools import wraps
|
16 |
import os
|
17 |
+
|
18 |
+
from google import genai
|
19 |
+
from google.genai import types
|
20 |
+
|
21 |
import textwrap
|
22 |
import PIL.Image
|
23 |
from werkzeug.utils import secure_filename
|
|
|
61 |
]
|
62 |
|
63 |
|
64 |
+
#genai.configure(api_key=GOOGLE_API_KEY)
|
65 |
|
66 |
+
client = genai.Client(
|
67 |
+
api_key=GOOGLE_API_KEY,
|
68 |
+
http_options={'api_version': 'v1alpha'},
|
69 |
+
)
|
70 |
|
71 |
MAX_CONTENT_LENGTH = 760 * 1024 * 1024 # 16MB max file size
|
72 |
|
|
|
406 |
prompt = methodologie
|
407 |
|
408 |
try:
|
409 |
+
response = client.models.generate_content_stream(
|
410 |
+
model="gemini-2.0-flash-thinking-exp-01-21",
|
411 |
+
config={'thinking_config': {'include_thoughts': True}},
|
412 |
+
contents=[prompt]
|
413 |
+
)
|
414 |
+
|
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
|