safiaa02 commited on
Commit
e546e82
·
verified ·
1 Parent(s): 0381854

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,8 +5,11 @@ import PyPDF2
5
  import docx2txt
6
  import json
7
 
8
- # Initialize OpenAI client
9
- client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
 
 
 
10
 
11
  # Helper functions
12
  def read_pdf(file_obj):
@@ -82,7 +85,7 @@ Respond in JSON format:
82
  max_tokens=4096
83
  )
84
  except Exception as e:
85
- return [f"⚠️ OpenAI API Error: {e}"] * 3
86
 
87
  try:
88
  candidates = json.loads(response.choices[0].message.content)
 
5
  import docx2txt
6
  import json
7
 
8
+ # Initialize OpenAI client (for AI/ML API)
9
+ client = OpenAI(
10
+ api_key=os.environ.get("OPENAI_API_KEY"),
11
+ base_url="https://api.aimlapi.com/v1"
12
+ )
13
 
14
  # Helper functions
15
  def read_pdf(file_obj):
 
85
  max_tokens=4096
86
  )
87
  except Exception as e:
88
+ return [f"⚠️ AI/ML API Error: {e}"] * 3
89
 
90
  try:
91
  candidates = json.loads(response.choices[0].message.content)