Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,9 +10,9 @@ def explain_text(selected_text):
|
|
| 10 |
if not selected_text or not selected_text.strip():
|
| 11 |
return "__NO_SELECTION__"
|
| 12 |
try:
|
| 13 |
-
response = client.
|
| 14 |
-
model="gpt-
|
| 15 |
-
|
| 16 |
{
|
| 17 |
"role": "system",
|
| 18 |
"content": (
|
|
@@ -26,10 +26,9 @@ def explain_text(selected_text):
|
|
| 26 |
"content": f'Explain this text from a learning resource:\n\n"""\n{selected_text}\n"""',
|
| 27 |
},
|
| 28 |
],
|
| 29 |
-
|
| 30 |
-
max_tokens=500,
|
| 31 |
)
|
| 32 |
-
return response.
|
| 33 |
except Exception as e:
|
| 34 |
return f"__ERROR__: {str(e)}"
|
| 35 |
|
|
|
|
| 10 |
if not selected_text or not selected_text.strip():
|
| 11 |
return "__NO_SELECTION__"
|
| 12 |
try:
|
| 13 |
+
response = client.responses.create(
|
| 14 |
+
model="gpt-4.1-mini",
|
| 15 |
+
input=[
|
| 16 |
{
|
| 17 |
"role": "system",
|
| 18 |
"content": (
|
|
|
|
| 26 |
"content": f'Explain this text from a learning resource:\n\n"""\n{selected_text}\n"""',
|
| 27 |
},
|
| 28 |
],
|
| 29 |
+
max_output_tokens=400,
|
|
|
|
| 30 |
)
|
| 31 |
+
return response.output_text
|
| 32 |
except Exception as e:
|
| 33 |
return f"__ERROR__: {str(e)}"
|
| 34 |
|