akhaliq HF Staff commited on
Commit
f777467
·
1 Parent(s): 9912408

add gemini models

Browse files
Files changed (2) hide show
  1. README.md +5 -1
  2. app.py +22 -0
README.md CHANGED
@@ -19,7 +19,7 @@ AnyCoder is an AI-powered code generator that helps you create applications by d
19
 
20
  ## Features
21
 
22
- - **Multi-Model Support**: Choose from Moonshot Kimi-K2, DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M1, Qwen3-235B-A22B, Qwen3-30B-A3B-Instruct-2507, Qwen3-30B-A3B-Thinking-2507, SmolLM3-3B, and GLM-4.1V-9B-Thinking
23
  - **Flexible Input**: Describe your app in text, upload a UI design image (for multimodal models), provide a reference file (PDF, TXT, MD, CSV, DOCX, or image), or enter a website URL for redesign
24
  - **Web Search Integration**: Enable real-time web search (Tavily, with advanced search depth) to enhance code generation with up-to-date information and best practices
25
  - **Code Generation**: Generate code in HTML, Python, JS, and more. Special support for transformers.js apps (outputs index.html, index.js, style.css)
@@ -46,6 +46,7 @@ export HF_TOKEN="your_huggingface_token"
46
  export TAVILY_API_KEY="your_tavily_api_key" # Optional, for web search feature
47
  export DASHSCOPE_API_KEY="your_dashscope_api_key" # Required for Qwen3-30B models via DashScope
48
  export POE_API_KEY="your_poe_api_key" # Required for GPT-5 and Grok-4 via Poe
 
49
  ```
50
 
51
  ## Usage
@@ -82,6 +83,8 @@ python app.py
82
  - GLM-4.1V-9B-Thinking (multimodal)
83
  - GPT-5 (via Poe)
84
  - Grok-4 (via Poe)
 
 
85
 
86
  ## Input Options
87
 
@@ -123,6 +126,7 @@ python app.py
123
 
124
  - `HF_TOKEN`: Your Hugging Face API token (required)
125
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
 
126
 
127
  ## Project Structure
128
 
 
19
 
20
  ## Features
21
 
22
+ - **Multi-Model Support**: Choose from Moonshot Kimi-K2, DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M1, Qwen3-235B-A22B, Qwen3-30B-A3B-Instruct-2507, Qwen3-30B-A3B-Thinking-2507, SmolLM3-3B, GLM-4.1V-9B-Thinking, Gemini 2.5 Flash and Gemini 2.5 Pro (OpenAI-compatible)
23
  - **Flexible Input**: Describe your app in text, upload a UI design image (for multimodal models), provide a reference file (PDF, TXT, MD, CSV, DOCX, or image), or enter a website URL for redesign
24
  - **Web Search Integration**: Enable real-time web search (Tavily, with advanced search depth) to enhance code generation with up-to-date information and best practices
25
  - **Code Generation**: Generate code in HTML, Python, JS, and more. Special support for transformers.js apps (outputs index.html, index.js, style.css)
 
46
  export TAVILY_API_KEY="your_tavily_api_key" # Optional, for web search feature
47
  export DASHSCOPE_API_KEY="your_dashscope_api_key" # Required for Qwen3-30B models via DashScope
48
  export POE_API_KEY="your_poe_api_key" # Required for GPT-5 and Grok-4 via Poe
49
+ export GEMINI_API_KEY="your_gemini_api_key" # Required for Gemini models
50
  ```
51
 
52
  ## Usage
 
83
  - GLM-4.1V-9B-Thinking (multimodal)
84
  - GPT-5 (via Poe)
85
  - Grok-4 (via Poe)
86
+ - Gemini 2.5 Flash (OpenAI-compatible)
87
+ - Gemini 2.5 Pro (OpenAI-compatible)
88
 
89
  ## Input Options
90
 
 
126
 
127
  - `HF_TOKEN`: Your Hugging Face API token (required)
128
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
129
+ - `GEMINI_API_KEY`: Your Google Gemini API key (required to use Gemini models)
130
 
131
  ## Project Structure
132
 
app.py CHANGED
@@ -512,6 +512,16 @@ AVAILABLE_MODELS = [
512
  "id": "codestral-2508",
513
  "description": "Mistral Codestral model - specialized for code generation and programming tasks"
514
  },
 
 
 
 
 
 
 
 
 
 
515
  {
516
  "name": "GPT-OSS-120B",
517
  "id": "openai/gpt-oss-120b",
@@ -653,6 +663,18 @@ def get_inference_client(model_id, provider="auto"):
653
  elif model_id == "codestral-2508":
654
  # Use Mistral client for Codestral model
655
  return Mistral(api_key=os.getenv("MISTRAL_API_KEY"))
 
 
 
 
 
 
 
 
 
 
 
 
656
  elif model_id == "openai/gpt-oss-120b":
657
  provider = "cerebras"
658
  elif model_id == "openai/gpt-oss-20b":
 
512
  "id": "codestral-2508",
513
  "description": "Mistral Codestral model - specialized for code generation and programming tasks"
514
  },
515
+ {
516
+ "name": "Gemini 2.5 Flash",
517
+ "id": "gemini-2.5-flash",
518
+ "description": "Google Gemini 2.5 Flash via OpenAI-compatible API"
519
+ },
520
+ {
521
+ "name": "Gemini 2.5 Pro",
522
+ "id": "gemini-2.5-pro",
523
+ "description": "Google Gemini 2.5 Pro via OpenAI-compatible API"
524
+ },
525
  {
526
  "name": "GPT-OSS-120B",
527
  "id": "openai/gpt-oss-120b",
 
663
  elif model_id == "codestral-2508":
664
  # Use Mistral client for Codestral model
665
  return Mistral(api_key=os.getenv("MISTRAL_API_KEY"))
666
+ elif model_id == "gemini-2.5-flash":
667
+ # Use Google Gemini (OpenAI-compatible) client
668
+ return OpenAI(
669
+ api_key=os.getenv("GEMINI_API_KEY"),
670
+ base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
671
+ )
672
+ elif model_id == "gemini-2.5-pro":
673
+ # Use Google Gemini Pro (OpenAI-compatible) client
674
+ return OpenAI(
675
+ api_key=os.getenv("GEMINI_API_KEY"),
676
+ base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
677
+ )
678
  elif model_id == "openai/gpt-oss-120b":
679
  provider = "cerebras"
680
  elif model_id == "openai/gpt-oss-20b":