Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def scrape_and_summarize(url):
|
|
| 29 |
text_content = text_content[:4000]
|
| 30 |
|
| 31 |
# Call OpenAI GPT-4o mini for summarization
|
| 32 |
-
response = openai.
|
| 33 |
model="gpt-4o-mini",
|
| 34 |
messages=[
|
| 35 |
{"role": "system", "content": "You are a helpful assistant that summarizes webpage content."},
|
|
@@ -37,7 +37,7 @@ def scrape_and_summarize(url):
|
|
| 37 |
]
|
| 38 |
)
|
| 39 |
|
| 40 |
-
summary = response["choices"][0]
|
| 41 |
return summary
|
| 42 |
|
| 43 |
except requests.exceptions.RequestException as e:
|
|
|
|
| 29 |
text_content = text_content[:4000]
|
| 30 |
|
| 31 |
# Call OpenAI GPT-4o mini for summarization
|
| 32 |
+
response = openai.chat.completions.create(
|
| 33 |
model="gpt-4o-mini",
|
| 34 |
messages=[
|
| 35 |
{"role": "system", "content": "You are a helpful assistant that summarizes webpage content."},
|
|
|
|
| 37 |
]
|
| 38 |
)
|
| 39 |
|
| 40 |
+
summary = response["choices"][0].message.content
|
| 41 |
return summary
|
| 42 |
|
| 43 |
except requests.exceptions.RequestException as e:
|