MatteoScript commited on
Commit
5322bcf
·
verified ·
1 Parent(s): 0007a1d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +15 -6
main.py CHANGED
@@ -516,12 +516,21 @@ def base64_in_immagine(dati_base64):
516
  @app.post("/Image_To_Text")
517
  def image_to_text(request: Request, input_data: InputImageToText):
518
  base64_in_immagine(input_data.base64)
519
- client = Client("vikhyatk/moondream2")
520
- result = client.predict(
521
- "/tmp/img.jpg",
522
- input_data.input,
523
- api_name="/answer_question_1"
524
- )
 
 
 
 
 
 
 
 
 
525
  LoggaTesto("IMMAGINE", {"response": result}, False)
526
  return {"response": result}
527
 
 
516
  @app.post("/Image_To_Text")
517
  def image_to_text(request: Request, input_data: InputImageToText):
518
  base64_in_immagine(input_data.base64)
519
+ Version = 1
520
+ if Version == 1:
521
+ client = Client("https://vikhyatk-moondream1.hf.space/--replicas/av7ct/")
522
+ result = client.predict(
523
+ "/tmp/img.jpg",
524
+ input_data.input,
525
+ api_name="/answer_question"
526
+ )
527
+ else:
528
+ client = Client("vikhyatk/moondream2")
529
+ result = client.predict(
530
+ "/tmp/img.jpg",
531
+ input_data.input,
532
+ api_name="/answer_question_1"
533
+ )
534
  LoggaTesto("IMMAGINE", {"response": result}, False)
535
  return {"response": result}
536