Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use this repo without internet? #23

Open
Minseong-COLI opened this issue Nov 28, 2023 · 2 comments
Open

Can I use this repo without internet? #23

Minseong-COLI opened this issue Nov 28, 2023 · 2 comments
Labels
feature question Further information is requested

Comments

@Minseong-COLI
Copy link

This repo use LLM model by calling API
But, I wanna use it like a import a library, such as easyocr, pororo etc..
Can I use BetterOCR and LLM model like that?

@junhoyeo
Copy link
Owner

junhoyeo commented Dec 3, 2023

@Minseong-COLI Sorry for the late reply, I'll try to modify it to support LLMs from the open source community like llama.cpp soon.
In the meantime, if you have any LLM models that you mainly install and use, please share them here.

@junhoyeo junhoyeo added feature question Further information is requested labels Feb 21, 2024
@PeterHagen
Copy link

PeterHagen commented Sep 15, 2024

Why not support Ollama? Ollama has a drop-in replacement API for ChatGPT. The only thing that has to be added is support for base_api in the openai settings:

openai={
  # OpenAI options here

  # `os.environ["OPENAI_API_KEY"]` is used by default
  "API_KEY": "ollama",
  "model": "llama3.1",
  "API_BASE": "http://localhost:11434/v1"
}

See here for some more information.

I tried the prompt manually with gemma2 and llama3.1, and they work perfectly. The boxes detection prompt doesn't seem to work out of the box at the moment.

I would suggest something like the following to be added in detect.py:

# Prioritize user-specified API_KEY and API_BASE
api_key = options["openai"].get("API_KEY", os.environ.get("OPENAI_API_KEY"))
api_base = options["openai"].get("API_BASE", os.environ.get("OPENAI_API_BASE"))

# Make a shallow copy of the openai options and remove the API_KEY
openai_options = options["openai"].copy()
if "API_KEY" in openai_options:
    del openai_options["API_KEY"]

if "API_BASE" in openai_options:
    del openai_options["API_BASE"]

client = OpenAI(
    api_key=api_key,
    api_base=api_base
)

print("=====")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants