bstraehle commited on
Commit
37ab520
·
1 Parent(s): a99f7b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -20,7 +20,6 @@ from dotenv import load_dotenv, find_dotenv
20
  _ = load_dotenv(find_dotenv())
21
 
22
  WANDB_API_KEY = os.environ["WANDB_API_KEY"]
23
- os.environ["LANGCHAIN_WANDB_TRACING"] = "true"
24
  os.environ["WANDB_PROJECT"] = "openai-llm-rag"
25
 
26
  MONGODB_URI = os.environ["MONGODB_ATLAS_CLUSTER_URI"]
@@ -122,6 +121,7 @@ def invoke(openai_api_key, rag_option, prompt):
122
  raise gr.Error("Retrieval Augmented Generation is required.")
123
  if (prompt == ""):
124
  raise gr.Error("Prompt is required.")
 
125
  completion = ""
126
  try:
127
  llm = ChatOpenAI(model_name = config["model"],
@@ -144,9 +144,9 @@ def invoke(openai_api_key, rag_option, prompt):
144
  except Exception as e:
145
  completion = e
146
  raise gr.Error(e)
147
- #finally:
148
- #wandb.finish()
149
- #autolog.disable()
150
  return completion
151
 
152
  description = """<strong>Overview:</strong> Context-aware multimodal reasoning application using a <strong>large language model (LLM)</strong> with
 
20
  _ = load_dotenv(find_dotenv())
21
 
22
  WANDB_API_KEY = os.environ["WANDB_API_KEY"]
 
23
  os.environ["WANDB_PROJECT"] = "openai-llm-rag"
24
 
25
  MONGODB_URI = os.environ["MONGODB_ATLAS_CLUSTER_URI"]
 
121
  raise gr.Error("Retrieval Augmented Generation is required.")
122
  if (prompt == ""):
123
  raise gr.Error("Prompt is required.")
124
+ os.environ["LANGCHAIN_WANDB_TRACING"] = "true"
125
  completion = ""
126
  try:
127
  llm = ChatOpenAI(model_name = config["model"],
 
144
  except Exception as e:
145
  completion = e
146
  raise gr.Error(e)
147
+ finally:
148
+ wandb.finish()
149
+ del os.environ["LANGCHAIN_WANDB_TRACING"]
150
  return completion
151
 
152
  description = """<strong>Overview:</strong> Context-aware multimodal reasoning application using a <strong>large language model (LLM)</strong> with