cryogenic22 commited on
Commit
45beb7e
·
verified ·
1 Parent(s): b03624d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -24,6 +24,13 @@ def load_openai_key():
24
  st.error(f"Error loading OpenAI API key from HuggingFace secrets: {str(e)}")
25
  return None
26
 
 
 
 
 
 
 
 
27
  def detect_chart_type(client, image_data):
28
  """Detect chart type using OpenAI's GPT-4 vision model"""
29
  try:
 
24
  st.error(f"Error loading OpenAI API key from HuggingFace secrets: {str(e)}")
25
  return None
26
 
27
+ def initialize_openai_client():
28
+ """Initialize OpenAI client with API key"""
29
+ api_key = load_openai_key()
30
+ if api_key:
31
+ return OpenAI(api_key=api_key)
32
+ return None
33
+
34
  def detect_chart_type(client, image_data):
35
  """Detect chart type using OpenAI's GPT-4 vision model"""
36
  try: