alexkueck commited on
Commit
f5360cb
1 Parent(s): 61d5bf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -135,7 +135,7 @@ os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
135
  ##############################################
136
  #wenn löschen Button geklickt
137
  def clear_all():
138
- return None, gr.Image(visible=False)
139
 
140
  ##############################################
141
  #History - die Frage oder das File eintragen...
@@ -561,9 +561,9 @@ def generate_text (prompt, chatbot, history, rag_option, model_option, openai_ap
561
  llm = ChatOpenAI(model_name = MODEL_NAME, openai_api_key = openai_api_key, temperature=temperature)#, top_p = top_p)
562
  #Prompt an history anhängen und einen Text daraus machen
563
  if (rag_option == "An"):
564
- history_text_und_prompt = generate_prompt_with_history(prompt, history)
565
  else:
566
- history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
567
  else:
568
  #oder an Hugging Face --------------------------
569
  print("HF Anfrage.......................")
@@ -573,7 +573,7 @@ def generate_text (prompt, chatbot, history, rag_option, model_option, openai_ap
573
  #llm = HuggingFaceTextGenInference( inference_server_url="http://localhost:8010/", max_new_tokens=max_new_tokens,top_k=10,top_p=top_p,typical_p=0.95,temperature=temperature,repetition_penalty=repetition_penalty,)
574
  print("HF")
575
  #Prompt an history anhängen und einen Text daraus machen
576
- history_text_und_prompt = generate_prompt_with_history(prompt, history)
577
 
578
  #zusätzliche Dokumenten Splits aus DB zum Prompt hinzufügen (aus VektorDB - Chroma oder Mongo DB)
579
  if (rag_option == "An"):
@@ -781,7 +781,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
781
  predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
782
  predict_event2 = submitBtn.click(**transfer_input_args, queue=False,).then(**predict_args)
783
  predict_event3 = upload.upload(file_anzeigen, [upload], [image_display, image_display, attached_file] ) #.then(**predict_args)
784
- emptyBtn.click(clear_all, [], [attached_file, image_display])
785
  image_display.select(file_loeschen, [], [attached_file, image_display])
786
 
787
  #Berechnung oder Ausgabe anhalten (kann danach fortgesetzt werden)
 
135
  ##############################################
136
  #wenn löschen Button geklickt
137
  def clear_all():
138
+ return None, gr.Image(visible=False), []
139
 
140
  ##############################################
141
  #History - die Frage oder das File eintragen...
 
561
  llm = ChatOpenAI(model_name = MODEL_NAME, openai_api_key = openai_api_key, temperature=temperature)#, top_p = top_p)
562
  #Prompt an history anhängen und einen Text daraus machen
563
  if (rag_option == "An"):
564
+ history_text_und_prompt = generate_prompt_with_history(prompt, chatbot)
565
  else:
566
+ history_text_und_prompt = generate_prompt_with_history_openai(prompt, chatbot)
567
  else:
568
  #oder an Hugging Face --------------------------
569
  print("HF Anfrage.......................")
 
573
  #llm = HuggingFaceTextGenInference( inference_server_url="http://localhost:8010/", max_new_tokens=max_new_tokens,top_k=10,top_p=top_p,typical_p=0.95,temperature=temperature,repetition_penalty=repetition_penalty,)
574
  print("HF")
575
  #Prompt an history anhängen und einen Text daraus machen
576
+ history_text_und_prompt = generate_prompt_with_history(prompt, chatbot)
577
 
578
  #zusätzliche Dokumenten Splits aus DB zum Prompt hinzufügen (aus VektorDB - Chroma oder Mongo DB)
579
  if (rag_option == "An"):
 
781
  predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
782
  predict_event2 = submitBtn.click(**transfer_input_args, queue=False,).then(**predict_args)
783
  predict_event3 = upload.upload(file_anzeigen, [upload], [image_display, image_display, attached_file] ) #.then(**predict_args)
784
+ emptyBtn.click(clear_all, [], [attached_file, image_display, history])
785
  image_display.select(file_loeschen, [], [attached_file, image_display])
786
 
787
  #Berechnung oder Ausgabe anhalten (kann danach fortgesetzt werden)