Spaces:
Sleeping
Sleeping
Fernando Cervan
commited on
Commit
·
7b3635b
1
Parent(s):
7a3b7b4
Salvando alterações
Browse files- Inferencia.py +3 -0
Inferencia.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import torch
|
| 3 |
import json
|
|
|
|
| 4 |
|
| 5 |
class Inferencia:
|
| 6 |
|
|
@@ -8,6 +9,7 @@ class Inferencia:
|
|
| 8 |
...
|
| 9 |
|
| 10 |
def extrair_dados_imagem(self, prompt, imagem):
|
|
|
|
| 11 |
pipe = pipeline(
|
| 12 |
"image-text-to-text",
|
| 13 |
model="google/gemma-3-4b-it",
|
|
@@ -28,6 +30,7 @@ class Inferencia:
|
|
| 28 |
}
|
| 29 |
]
|
| 30 |
|
|
|
|
| 31 |
output = pipe(text=messages, max_new_tokens=200)
|
| 32 |
|
| 33 |
return output[0]["generated_text"][-1]["content"]
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import torch
|
| 3 |
import json
|
| 4 |
+
from LogCustomizado import LogCustomizado as logc
|
| 5 |
|
| 6 |
class Inferencia:
|
| 7 |
|
|
|
|
| 9 |
...
|
| 10 |
|
| 11 |
def extrair_dados_imagem(self, prompt, imagem):
|
| 12 |
+
logc.gerar_log(mensagem_log="EXECUTANDO PIPELINE...")
|
| 13 |
pipe = pipeline(
|
| 14 |
"image-text-to-text",
|
| 15 |
model="google/gemma-3-4b-it",
|
|
|
|
| 30 |
}
|
| 31 |
]
|
| 32 |
|
| 33 |
+
logc.gerar_log(mensagem_log="OBTENDO RESPOSTA DA PIPE...")
|
| 34 |
output = pipe(text=messages, max_new_tokens=200)
|
| 35 |
|
| 36 |
return output[0]["generated_text"][-1]["content"]
|