Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from litellm import completion
|
| 3 |
import os
|
| 4 |
-
import yaml
|
| 5 |
|
| 6 |
# Load configuration from YAML file
|
| 7 |
-
config_path = "config.yaml"
|
| 8 |
-
if not os.path.exists(config_path):
|
| 9 |
-
|
| 10 |
-
with open(config_path, 'r') as file:
|
| 11 |
-
|
| 12 |
|
| 13 |
-
os.environ["OPENAI_API_KEY"] = config.get("model_list", "")[0].get("litellm_params", "").get("api_key", "")
|
| 14 |
# os.environ["GEMINI_API_KEY"] = config.get("model_list", "")[1].get("litellm_params", "").get("api_key", "")
|
| 15 |
|
|
|
|
|
|
|
| 16 |
def route_llm_request(model, messages, api_key):
|
| 17 |
# Verify the class API key
|
| 18 |
if api_key != "your-class-key":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from litellm import completion
|
| 3 |
import os
|
| 4 |
+
# import yaml
|
| 5 |
|
| 6 |
# Load configuration from YAML file
|
| 7 |
+
# config_path = "config.yaml"
|
| 8 |
+
# if not os.path.exists(config_path):
|
| 9 |
+
# raise FileNotFoundError(f"Configuration file {config_path} not found.")
|
| 10 |
+
# with open(config_path, 'r') as file:
|
| 11 |
+
# config = yaml.safe_load(file)
|
| 12 |
|
| 13 |
+
# os.environ["OPENAI_API_KEY"] = config.get("model_list", "")[0].get("litellm_params", "").get("api_key", "")
|
| 14 |
# os.environ["GEMINI_API_KEY"] = config.get("model_list", "")[1].get("litellm_params", "").get("api_key", "")
|
| 15 |
|
| 16 |
+
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
| 17 |
+
|
| 18 |
def route_llm_request(model, messages, api_key):
|
| 19 |
# Verify the class API key
|
| 20 |
if api_key != "your-class-key":
|