Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
|
@@ -505,9 +505,7 @@ def generate_image(request: Request, input_data: InputImage):
|
|
| 505 |
#--------------------------------------------------- IMAGE TO TEXT ------------------------------------------------------
|
| 506 |
class InputImageToText(BaseModel):
|
| 507 |
base64: str
|
| 508 |
-
|
| 509 |
-
input_text: str = ''
|
| 510 |
-
max_new_tokens: int = 100
|
| 511 |
|
| 512 |
def base64_in_immagine(dati_base64):
|
| 513 |
immagine = base64.b64decode(dati_base64)
|
|
@@ -521,7 +519,7 @@ def image_to_text(request: Request, input_data: InputImageToText):
|
|
| 521 |
client = Client("vikhyatk/moondream2")
|
| 522 |
result = client.predict(
|
| 523 |
"/tmp/img.jpg",
|
| 524 |
-
|
| 525 |
api_name="/answer_question_1"
|
| 526 |
)
|
| 527 |
LoggaTesto("IMMAGINE", {"response": result}, False)
|
|
|
|
| 505 |
#--------------------------------------------------- IMAGE TO TEXT ------------------------------------------------------
|
| 506 |
class InputImageToText(BaseModel):
|
| 507 |
base64: str
|
| 508 |
+
input: str = 'describe this image in detail'
|
|
|
|
|
|
|
| 509 |
|
| 510 |
def base64_in_immagine(dati_base64):
|
| 511 |
immagine = base64.b64decode(dati_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)
|