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

Support base_url in OpenAI module #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kazuhitoyokoi
Copy link

The OpenAI module already has functionality to access other APIs. This pull request allows the base_url setting to specify other APIs. For example, by supporting this setting, we can access Google Gemini API or Ollama API using the following code.

Google Gemini

import gradio as gr
import openai_gradio

gr.load(
    name='gemini-2.0-flash-exp',
    token='<Gemini API Key>',
    base_url="https://generativelanguage.googleapis.com/v1beta/",
    src=openai_gradio.registry,
).launch()

Ollama

import gradio as gr
import openai_gradio

gr.load(
    name='llama3.2',
    token='ollama',
    base_url="http://localhost:11434/v1",
    src=openai_gradio.registry,
).launch()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant