ning8429 commited on
Commit
77f0a99
·
verified ·
1 Parent(s): 3aeea53

Update api_server.py

Browse files
Files changed (1) hide show
  1. api_server.py +4 -5
api_server.py CHANGED
@@ -25,8 +25,8 @@ load_type = 'local'
25
  MODEL_YOLO = "yolo11_detect_best_241024_1.pt"
26
  MODEL_DIR = "./artifacts/models"
27
  YOLO_DIR = "./artifacts/yolo"
28
- IMG2TEXT_URL = "https://fd39e54bcb191a37bf.gradio.live/"
29
- TEXT2IMG_URL = "https://0816a20213827bdb75.gradio.live/"
30
 
31
 
32
  # Load the saved YOLO model into memory
@@ -217,9 +217,8 @@ def text2img():
217
  word= text_message,
218
  api_name="/predict"
219
  )
220
- print(f"===== FLASK API---/text2img 文字轉圖片result[0]:{result[0]} =====")
221
- result_img = image_to_base64(result[0])
222
- print(f"===== FLASK API---/text2img 文字轉圖片轉base64:{result_img} =====")
223
 
224
  # 建立回應資料
225
  response_data = {
 
25
  MODEL_YOLO = "yolo11_detect_best_241024_1.pt"
26
  MODEL_DIR = "./artifacts/models"
27
  YOLO_DIR = "./artifacts/yolo"
28
+ IMG2TEXT_URL = "https://fd39e54bcb191a37bf.gradio.live/" # 圖生文
29
+ TEXT2IMG_URL = "https://e0ac675070fceb8e63.gradio.live/" # 文生圖
30
 
31
 
32
  # Load the saved YOLO model into memory
 
217
  word= text_message,
218
  api_name="/predict"
219
  )
220
+ print(f"===== FLASK API---/text2img 文字轉圖片result:{result} =====")
221
+ result_img = result[2] # 已經是base64 coded
 
222
 
223
  # 建立回應資料
224
  response_data = {