Skip to content

Commit 024d4a3

Browse files
committed
Add environment-specific tracing tags for Gradio deployment
- Import os module to handle environment variables - Add APP_ENVIRONMENT variable with default "dev" - Include tracing tags in predict function with environment context
1 parent effbaa3 commit 024d4a3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llm-complete-guide/deployment_hf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import os
23

34
import gradio as gr
45
from constants import SECRET_NAME
@@ -9,6 +10,8 @@
910
logging.basicConfig(level=logging.INFO)
1011
logger = logging.getLogger(__name__)
1112

13+
APP_ENVIRONMENT = os.getenv("GRADIO_ZENML_APP_ENVIRONMENT", "dev")
14+
1215
# Initialize ZenML client and verify secret access
1316
try:
1417
client = Client()
@@ -27,6 +30,7 @@ def predict(message, history):
2730
input=message,
2831
n_items_retrieved=20,
2932
use_reranking=True,
33+
tracing_tags=["gradio", "web-interface", APP_ENVIRONMENT],
3034
)
3135
except Exception as e:
3236
logger.error(f"Error processing message: {e}")

0 commit comments

Comments
 (0)