Olivier-52 commited on
Commit
2d0c057
·
1 Parent(s): 87db37e

Update app.py

Browse files

return dict instead of json

Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -49,17 +49,11 @@ def index():
49
 
50
  @app.get("/get_news", tags=["Generator"])
51
  def get_news():
52
- """Return a random news about climate change.
53
-
54
- This endpoint does not take any parameters and returns a random news
55
- about climate change in JSON format.
56
-
57
- Returns:
58
- dict: A JSON object containing a random news about climate change.
59
- """
60
  if data.empty:
61
  return {"error": "No data available"}
62
- return data.sample(1).to_json(orient="records")
63
 
64
  if __name__ == "__main__":
 
65
  uvicorn.run(app, host="localhost", port=8000)
 
49
 
50
  @app.get("/get_news", tags=["Generator"])
51
  def get_news():
52
+ """Return a random news about climate change."""
 
 
 
 
 
 
 
53
  if data.empty:
54
  return {"error": "No data available"}
55
+ return data.sample(1).to_dict(orient="records")
56
 
57
  if __name__ == "__main__":
58
+ import uvicorn
59
  uvicorn.run(app, host="localhost", port=8000)