Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,13 +38,11 @@ def summarize_text(text):
|
|
| 38 |
return "no content to summarize"
|
| 39 |
|
| 40 |
try:
|
| 41 |
-
response = openai.
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
max_tokens=200,
|
| 45 |
-
temperature=0.5,
|
| 46 |
)
|
| 47 |
-
summary = response
|
| 48 |
return summary
|
| 49 |
except Exception as e:
|
| 50 |
st.error(f"Error with OpenAI API: {e}")
|
|
|
|
| 38 |
return "no content to summarize"
|
| 39 |
|
| 40 |
try:
|
| 41 |
+
response = openai.chat.completions.create(
|
| 42 |
+
model = "gpt-4o-mini",
|
| 43 |
+
messages = messages_for(website)
|
|
|
|
|
|
|
| 44 |
)
|
| 45 |
+
summary = response.choices[0].message.content.strip()
|
| 46 |
return summary
|
| 47 |
except Exception as e:
|
| 48 |
st.error(f"Error with OpenAI API: {e}")
|