alexkueck commited on
Commit
cf21012
1 Parent(s): 0bba95d

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +4 -4
utils.py CHANGED
@@ -322,7 +322,7 @@ def generate_prompt_with_history_langchain(prompt, history):
322
  ##########################################
323
  #ein hochgeladenes Bild so vorbereiten, dass OpenAI API es annehmen kann und bearbeiten
324
  #muss ein base64 Bils sein und header und payload entsprechend konfigurieren
325
- def process_image(image_path, prompt, model_image):
326
  # Convert image to base64
327
  with open(image_path, "rb") as image_file:
328
  encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
@@ -330,7 +330,7 @@ def process_image(image_path, prompt, model_image):
330
  # Prepare the data for the API request (specific to the API you're using)
331
  headers = {
332
  "Content-Type": "application/json",
333
- "Authorization": f"Bearer {OAI_API_KEY}"
334
  }
335
  payload = {
336
  "model": model_image,
@@ -356,11 +356,11 @@ def process_image(image_path, prompt, model_image):
356
  return headers, payload
357
 
358
 
359
- def process_chatverlauf(prompt, model):
360
  # Prepare the data for the API request (specific to the API you're using)
361
  headers = {
362
  "Content-Type": "application/json",
363
- "Authorization": f"Bearer {OAI_API_KEY}"
364
  }
365
  payload = {
366
  "model": model,
 
322
  ##########################################
323
  #ein hochgeladenes Bild so vorbereiten, dass OpenAI API es annehmen kann und bearbeiten
324
  #muss ein base64 Bils sein und header und payload entsprechend konfigurieren
325
+ def process_image(image_path, prompt, model_image, oai_key):
326
  # Convert image to base64
327
  with open(image_path, "rb") as image_file:
328
  encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
 
330
  # Prepare the data for the API request (specific to the API you're using)
331
  headers = {
332
  "Content-Type": "application/json",
333
+ "Authorization": f"Bearer {oai_key}"
334
  }
335
  payload = {
336
  "model": model_image,
 
356
  return headers, payload
357
 
358
 
359
+ def process_chatverlauf(prompt, model, oai_key):
360
  # Prepare the data for the API request (specific to the API you're using)
361
  headers = {
362
  "Content-Type": "application/json",
363
+ "Authorization": f"Bearer {oai_key}"
364
  }
365
  payload = {
366
  "model": model,