Update app.py
Browse files
app.py
CHANGED
@@ -390,8 +390,7 @@ def rag_chain2(prompt, db, k=3):
|
|
390 |
neu_prompt = rag_template
|
391 |
for i, chunk in enumerate(retrieved_chunks):
|
392 |
neu_prompt += f"{i+1}. {chunk}\n"
|
393 |
-
|
394 |
-
print(neu_prompt)
|
395 |
return neu_prompt
|
396 |
|
397 |
###################################################
|
@@ -507,8 +506,6 @@ def generate_text_zu_bild(file, prompt, k, rag_option, chatbot):
|
|
507 |
global splittet
|
508 |
|
509 |
prompt_neu = prompt
|
510 |
-
print("rag_option................................")
|
511 |
-
print(rag_option)
|
512 |
if (rag_option == "An"):
|
513 |
#muss nur einmal ausgeführt werden...
|
514 |
if not splittet:
|
@@ -521,8 +518,7 @@ def generate_text_zu_bild(file, prompt, k, rag_option, chatbot):
|
|
521 |
#prompt = generate_prompt_with_history_openai(neu_text_mit_chunks, history)
|
522 |
#als reiner prompt:
|
523 |
prompt_neu = generate_prompt_with_history(neu_text_mit_chunks, chatbot)
|
524 |
-
|
525 |
-
print(prompt_neu)
|
526 |
headers, payload = process_image(file, prompt_neu)
|
527 |
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
|
528 |
#als json ausgeben
|
@@ -537,9 +533,6 @@ def generate_text_zu_bild(file, prompt, k, rag_option, chatbot):
|
|
537 |
def generate_text (prompt, 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,):
|
538 |
global splittet
|
539 |
|
540 |
-
print("prompt:.......................")
|
541 |
-
print(prompt)
|
542 |
-
|
543 |
if (openai_api_key == "" or openai_api_key == "sk-"):
|
544 |
#raise gr.Error("OpenAI API Key is required.")
|
545 |
#eigenen OpenAI key nutzen
|
|
|
390 |
neu_prompt = rag_template
|
391 |
for i, chunk in enumerate(retrieved_chunks):
|
392 |
neu_prompt += f"{i+1}. {chunk}\n"
|
393 |
+
|
|
|
394 |
return neu_prompt
|
395 |
|
396 |
###################################################
|
|
|
506 |
global splittet
|
507 |
|
508 |
prompt_neu = prompt
|
|
|
|
|
509 |
if (rag_option == "An"):
|
510 |
#muss nur einmal ausgeführt werden...
|
511 |
if not splittet:
|
|
|
518 |
#prompt = generate_prompt_with_history_openai(neu_text_mit_chunks, history)
|
519 |
#als reiner prompt:
|
520 |
prompt_neu = generate_prompt_with_history(neu_text_mit_chunks, chatbot)
|
521 |
+
|
|
|
522 |
headers, payload = process_image(file, prompt_neu)
|
523 |
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
|
524 |
#als json ausgeben
|
|
|
533 |
def generate_text (prompt, 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,):
|
534 |
global splittet
|
535 |
|
|
|
|
|
|
|
536 |
if (openai_api_key == "" or openai_api_key == "sk-"):
|
537 |
#raise gr.Error("OpenAI API Key is required.")
|
538 |
#eigenen OpenAI key nutzen
|