Demosthene-OR commited on
Commit
d67826b
1 Parent(s): ad799ea

Update main_dl.py

Browse files
Files changed (1) hide show
  1. main_dl.py +7 -2
main_dl.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI, HTTPException, Header, Depends, Request
2
  from fastapi.responses import JSONResponse
3
  from fastapi.security import HTTPBasic, HTTPBasicCredentials
4
  from fastapi.exceptions import RequestValidationError
@@ -310,7 +310,12 @@ def check_api(lang_tgt:str,
310
  else:
311
  translation_model = transformer_en_fr
312
  plot_model(translation_model, show_shapes=True, show_layer_names=True, show_layer_activations=True,rankdir='TB',to_file=imagePath+'/model_plot.png')
313
- return
 
 
 
 
 
314
  '''
315
  def run():
316
 
 
1
+ from fastapi import FastAPI, HTTPException, Header, Depends, Request, Response
2
  from fastapi.responses import JSONResponse
3
  from fastapi.security import HTTPBasic, HTTPBasicCredentials
4
  from fastapi.exceptions import RequestValidationError
 
310
  else:
311
  translation_model = transformer_en_fr
312
  plot_model(translation_model, show_shapes=True, show_layer_names=True, show_layer_activations=True,rankdir='TB',to_file=imagePath+'/model_plot.png')
313
+ with open(imagePath+'/model_plot.png', "rb") as image_file:
314
+ # Lire les données de l'image
315
+ image_data = image_file.read()
316
+
317
+ # Retourner l'image en tant que réponse HTTP avec le type de contenu approprié
318
+ return Response(content=image_data, media_type="image/png")
319
  '''
320
  def run():
321