alexkueck commited on
Commit
9569fab
1 Parent(s): 5473db2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -391,7 +391,7 @@ def generate_auswahl(prompt, file, chatbot, history, rag_option, model_option, o
391
  image = Image.open(io.BytesIO(result))
392
  image_64 = umwandeln_fuer_anzeige(image)
393
  chatbot[-1][1] = "<img src='data:image/png;base64,{0}'/>".format(b64encode(image_64).decode('utf-8'))
394
- history[-1][1] = b64encode(image_64).decode('utf-8')
395
  print("history zeichnen......................")
396
  print(chatbot)
397
  return chatbot, history, "Success"
@@ -399,7 +399,11 @@ def generate_auswahl(prompt, file, chatbot, history, rag_option, model_option, o
399
  result = generate_text(prompt, file, chatbot, history, rag_option, model_option, openai_api_key, k=3, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3,)
400
  #Antwort als Stream ausgeben... wenn Textantwort gefordert
401
  chatbot[-1][1] = result
402
- history[-1][1] = result
 
 
 
 
403
  print("history nach Zusatz und mit KI Antwort...........")
404
  print(chatbot)
405
  return chatbot, history, "Success"
@@ -439,7 +443,9 @@ def generate_text (prompt, file, chatbot, history, rag_option, model_option, ope
439
  if (file == None):
440
  history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
441
  else:
442
- prompt_neu = prompt + file.path, #b64encode(file).decode("utf-8")
 
 
443
  print("prompt_neu............................")
444
  print(prompt_neu)
445
  history_text_und_prompt = generate_prompt_with_history_openai(prompt_neu, history)
 
391
  image = Image.open(io.BytesIO(result))
392
  image_64 = umwandeln_fuer_anzeige(image)
393
  chatbot[-1][1] = "<img src='data:image/png;base64,{0}'/>".format(b64encode(image_64).decode('utf-8'))
394
+ history = history + [[prompt, b64encode(image_64).decode('utf-8')]]
395
  print("history zeichnen......................")
396
  print(chatbot)
397
  return chatbot, history, "Success"
 
399
  result = generate_text(prompt, file, chatbot, history, rag_option, model_option, openai_api_key, k=3, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3,)
400
  #Antwort als Stream ausgeben... wenn Textantwort gefordert
401
  chatbot[-1][1] = result
402
+ if (file == None):
403
+ history = history + [[prompt, result]]
404
+ else:
405
+ history = history + [[prompt+"hier noch die URL zum File", result]]
406
+
407
  print("history nach Zusatz und mit KI Antwort...........")
408
  print(chatbot)
409
  return chatbot, history, "Success"
 
443
  if (file == None):
444
  history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
445
  else:
446
+ print("file....................")
447
+ print(file)
448
+ prompt_neu = prompt + b64encode(file).decode("utf-8").path()
449
  print("prompt_neu............................")
450
  print(prompt_neu)
451
  history_text_und_prompt = generate_prompt_with_history_openai(prompt_neu, history)