Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
import os
|
2 |
import logging
|
3 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
|
4 |
import gradio as gr
|
5 |
import threading
|
6 |
import time
|
@@ -287,8 +292,8 @@ def get_history_by_session_id(session_id):
|
|
287 |
def get_llm(model: str):
|
288 |
"""Retrieve the specified language model based on the model name."""
|
289 |
model = model.lower().strip()
|
290 |
-
env_key = f"LLM_MODEL_CONFIG_{model.replace('-', '_')}"
|
291 |
-
env_value = os.environ.get(env_key)
|
292 |
|
293 |
if not env_value:
|
294 |
err = f"Environment variable '{env_key}' is not defined as per format or missing"
|
|
|
1 |
import os
|
2 |
import logging
|
3 |
from dotenv import load_dotenv
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
# Force reinstall Gradio
|
7 |
+
subprocess.run(["pip", "install", "--upgrade", "gradio==4.44.1"])
|
8 |
+
|
9 |
import gradio as gr
|
10 |
import threading
|
11 |
import time
|
|
|
292 |
def get_llm(model: str):
|
293 |
"""Retrieve the specified language model based on the model name."""
|
294 |
model = model.lower().strip()
|
295 |
+
env_key = f"LLM_MODEL_CONFIG_{model.replace('-', '_').replace('.', '_')}" # Replace both dashes and periods
|
296 |
+
env_value = os.environ.get(env_key.upper())
|
297 |
|
298 |
if not env_value:
|
299 |
err = f"Environment variable '{env_key}' is not defined as per format or missing"
|