|
@@ -144,6 +144,7 @@ async def callback(request: fastapi.Request):
|
|
|
|
|
|
@app.get('/get_trend_image')
|
|
|
async def get_trend_image(kw):
|
|
|
+#def get_trend_image(kw):
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/yodb?charset=utf8mb4')
|
|
|
sql_get_newest_data_date = 'SELECT * FROM interest_over_time WHERE iot_kword="'+kw+'" ORDER BY iot_date'
|
|
|
x_axis = []
|
|
@@ -163,7 +164,7 @@ async def get_trend_image(kw):
|
|
|
plt.plot(x, y,'r-^') # 設定樣式
|
|
|
plt.savefig(target_path, bbox_inches='tight') #存檔,第二個參數表示把圖表外多餘的空間刪除
|
|
|
|
|
|
- return target_path
|
|
|
+ return FileResponse(target_path)
|
|
|
|
|
|
|
|
|
def get_news_by_kw(keyword):
|