Ollama + new Gemma3 + Vison support

226 views
Skip to first unread message

antonio....@gmail.com

unread,
Mar 16, 2025, 12:09:53 PM3/16/25
to Harbour Users
New Gemma3 + vision from Google locally runs using Ollama, so you can have free OCR + IA for your Harbour apps:

El nuevo Gemma3 + visión de Google funciona localmente usando Ollama, por lo que puedes tener gratis OCR + IA desde tus Harbour apps:

REQUEST HB_CODEPAGE_ESWIN 

function Main() 

   local oChat := TOLlama():New( "gemma3" ) 

   hb_SetCodePage( "ESWIN" ) 
   oChat:SendImage( "equation.png", "resuelve x" ) 
   ? hb_Utf8ToStr( oChat:GetValue() ) )
    oChat:End() 

return nil


saludos

roberto....@gmail.com

unread,
Mar 17, 2025, 8:50:34 PM3/17/25
to Harbour Users
Hi Antonio,
I don't have TOllama class with SendImage() method, can you please send it?
I really would like to test it!
many thanks

antonio....@gmail.com

unread,
Mar 18, 2025, 10:05:16 AM3/18/25
to Harbour Users
Already sent to your email and a working example,

best regards

roberto....@gmail.com

unread,
Mar 18, 2025, 12:32:09 PM3/18/25
to Harbour Users
thank you so much, I will try asap!

roberto....@gmail.com

unread,
Mar 18, 2025, 1:04:14 PM3/18/25
to Harbour Users
hi,
I made the following fix:

METHOD GetValue() CLASS TOLlama

   local hResponse, uValue  
   
   hb_jsonDecode( ::cResponse, @hResponse )

   TRY
      uValue = hResponse[ "message" ][ "content" ]
   CATCH
      //uValue = hResponse[ "error" ][ "message" ]
      uValue = hResponse[ "error" ] // fix r.c.
/*  
Descrizione dell'errore: Error BASE/1068  Parametro errato: accesso all'array
   Args:
     [   1] = C  model "gemma3" not found, try pulling it first  
     [   2] = C  message 
*/
   END  
return uValue
Reply all
Reply to author
Forward
0 new messages