Skip to main content

A Python package for creating Gradio applications with AI models

Project description

ai-gradio

A Python package that makes it easy for developers to create machine learning apps powered by various AI providers. Built on top of Gradio, it provides a unified interface for multiple AI models and services.

Features

Core Features

  • Multi-Provider Support: Integrate with 15+ AI providers including OpenAI, Google Gemini, Anthropic, and more
  • Text Chat: Interactive chat interfaces for all text models
  • Voice Chat: Real-time voice interactions with OpenAI models
  • Video Chat: Video processing capabilities with Gemini models
  • Code Generation: Specialized interfaces for coding assistance
  • Multi-Modal: Support for text, image, and video inputs
  • Agent Teams: CrewAI integration for collaborative AI tasks
  • Browser Automation: AI agents that can perform web-based tasks

Model Support

Core Language Models

Provider Models
OpenAI gpt-4-turbo, gpt-4, gpt-3.5-turbo
Anthropic claude-3-opus, claude-3-sonnet, claude-3-haiku
Gemini gemini-pro, gemini-pro-vision, gemini-2.0-flash-exp
Groq llama-3.2-70b-chat, mixtral-8x7b-chat

Specialized Models

Provider Type Models
LumaAI Generation dream-machine, photon-1
DeepSeek Multi-purpose deepseek-chat, deepseek-coder, deepseek-vision
CrewAI Agent Teams Support Team, Article Team
Qwen Language qwen-turbo, qwen-plus, qwen-max
Browser Automation browser-use-agent

Installation

Basic Installation

# Install core package
pip install ai-gradio

# Install with specific provider support
pip install 'ai-gradio[openai]'     # OpenAI support
pip install 'ai-gradio[gemini]'     # Google Gemini support
pip install 'ai-gradio[anthropic]'  # Anthropic Claude support
pip install 'ai-gradio[groq]'       # Groq support

# Install all providers
pip install 'ai-gradio[all]'

Additional Providers

pip install 'ai-gradio[crewai]'     # CrewAI support
pip install 'ai-gradio[lumaai]'     # LumaAI support
pip install 'ai-gradio[xai]'        # XAI/Grok support
pip install 'ai-gradio[cohere]'     # Cohere support
pip install 'ai-gradio[sambanova]'  # SambaNova support
pip install 'ai-gradio[hyperbolic]' # Hyperbolic support
pip install 'ai-gradio[deepseek]'   # DeepSeek support
pip install 'ai-gradio[smolagents]' # SmolagentsAI support
pip install 'ai-gradio[fireworks]'  # Fireworks support
pip install 'ai-gradio[together]'   # Together support
pip install 'ai-gradio[qwen]'       # Qwen support
pip install 'ai-gradio[browser]'    # Browser support

Usage

API Key Configuration

# Core Providers
export OPENAI_API_KEY=<your token>
export GEMINI_API_KEY=<your token>
export ANTHROPIC_API_KEY=<your token>
export GROQ_API_KEY=<your token>

# Additional Providers (as needed)
export LUMAAI_API_KEY=<your token>
export XAI_API_KEY=<your token>
export COHERE_API_KEY=<your token>
# ... (other provider keys)

Quick Start

import gradio as gr
import ai_gradio

# Create a simple chat interface
gr.load(
    name='openai:gpt-4-turbo',  # or 'gemini:gemini-1.5-flash', 'groq:llama-3.2-70b-chat'
    src=ai_gradio.registry,
    title='AI Chat',
    description='Chat with an AI model'
).launch()

# Create a coding assistant
gr.load(
    name='gemini:gemini-2.0-flash-thinking-exp-1219',  # or 'openai:gpt-4-turbo', 'anthropic:claude-3-opus'
    src=ai_gradio.registry,
    coder=True,
    title='Gemini Code Generator',
).launch()

Advanced Features

Voice Chat

gr.load(
    name='openai:gpt-4-turbo',
    src=ai_gradio.registry,
    enable_voice=True,
    title='AI Voice Assistant'
).launch()

Multi-Provider Interface

import gradio as gr
import ai_gradio

with gr.Blocks() as demo:
    with gr.Tab("Text"):
        gr.load('openai:gpt-4-turbo', src=ai_gradio.registry)
    with gr.Tab("Vision"):
        gr.load('gemini:gemini-pro-vision', src=ai_gradio.registry)
    with gr.Tab("Code"):
        gr.load('deepseek:deepseek-coder', src=ai_gradio.registry)

demo.launch()

CrewAI Teams

# Article Creation Team
gr.load(
    name='crewai:gpt-4-turbo',
    src=ai_gradio.registry,
    crew_type='article',
    title='AI Writing Team'
).launch()

Browser Automation

playwright install

use python 3.11+ for browser use

import gradio as gr
import ai_gradio

# Create a browser automation interface
gr.load(
    name='browser:gpt-4-turbo',
    src=ai_gradio.registry,
    title='AI Browser Assistant',
    description='Let AI help with web tasks'
).launch()

Example tasks:

  • Flight searches on Google Flights
  • Weather lookups
  • Product price comparisons
  • News searches

Swarms Integration

import gradio as gr
import ai_gradio

# Create a chat interface with Swarms
gr.load(
    name='swarms:gpt-4-turbo',  # or other OpenAI models
    src=ai_gradio.registry,
    agent_name="Stock-Analysis-Agent",  # customize agent name
    title='Swarms Chat',
    description='Chat with an AI agent powered by Swarms'
).launch()

Requirements

Core Requirements

  • Python 3.10+
  • gradio >= 5.9.1

Optional Features

  • Voice Chat: gradio-webrtc, numba==0.60.0, pydub, librosa
  • Video Chat: opencv-python, Pillow
  • Agent Teams: crewai>=0.1.0, langchain>=0.1.0

Troubleshooting

Authentication Issues

If you encounter 401 errors, verify your API keys:

import os

# Set API keys manually if needed
os.environ["OPENAI_API_KEY"] = "your-api-key"
os.environ["GEMINI_API_KEY"] = "your-api-key"

Provider Installation

If you see "no providers installed" errors:

# Install specific provider
pip install 'ai-gradio[provider_name]'

# Or install all providers
pip install 'ai-gradio[all]'

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_gradio-0.2.7.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_gradio-0.2.7-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file ai_gradio-0.2.7.tar.gz.

File metadata

  • Download URL: ai_gradio-0.2.7.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for ai_gradio-0.2.7.tar.gz
Algorithm Hash digest
SHA256 3b22203bb1c6b93fcc26476b6c86720901eac2f5cbe3b418b08f9024f1f8ea25
MD5 6b2982959706ffba7598f9892d503c2f
BLAKE2b-256 e16fee49dafe25f18a6adfcbc818cf429da2fa7570ebe0aa47e37aa13dbba0a6

See more details on using hashes here.

File details

Details for the file ai_gradio-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: ai_gradio-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for ai_gradio-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 34245a874d4aa71b56e5e8289017096bd119faa477ba965e1cacd4fcd58ed947
MD5 767e6ee41f4fff0982a19baab0be04cb
BLAKE2b-256 1c7f668b17d9b0d34f90ec7db7fa800623d59e910dff19ae45adf42460846e60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page