MatteoScript commited on
Commit
00dd371
·
verified ·
1 Parent(s): 1290705

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -509,8 +509,9 @@ class InputImageToText(BaseModel):
509
 
510
  def base64_in_immagine(dati_base64):
511
  immagine = base64.b64decode(dati_base64)
 
512
  immagine_pil = Image.open(BytesIO(immagine))
513
- nome_file = "img.jpg"
514
  immagine_pil.save(nome_file)
515
 
516
  @app.post("/Image_To_Text")
@@ -519,7 +520,7 @@ def image_to_text(request: Request, input_data: InputImageToText):
519
  print(input_data.base64)
520
  client = Client("vikhyatk/moondream2")
521
  result = client.predict(
522
- "img.jpg",
523
  "",
524
  api_name="/answer_question_1"
525
  )
 
509
 
510
  def base64_in_immagine(dati_base64):
511
  immagine = base64.b64decode(dati_base64)
512
+ f"/tmp/image_{os.getpid()}.png"
513
  immagine_pil = Image.open(BytesIO(immagine))
514
+ nome_file = "/tmp/img.jpg"
515
  immagine_pil.save(nome_file)
516
 
517
  @app.post("/Image_To_Text")
 
520
  print(input_data.base64)
521
  client = Client("vikhyatk/moondream2")
522
  result = client.predict(
523
+ "/tmp/img.jpg",
524
  "",
525
  api_name="/answer_question_1"
526
  )