Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -502,10 +502,12 @@ def generate_text (prompt, chatbot, history, rag_option, model_option, openai_ap
|
|
| 502 |
|
| 503 |
#Funktion wird direkt aufgerufen aus der GUI - von hier muss auch die Rückmeldung kommen....
|
| 504 |
#man kann einen Text-Prompt eingeben , dazu ein Image hochladen, und dann dazu code erzeugen lassen
|
| 505 |
-
def generate_code(prompt_in, file, chatbot, history,
|
| 506 |
#prompt normalisieren bevor er an die KIs geht
|
| 507 |
prompt = normalise_prompt(prompt_in)
|
| 508 |
-
|
|
|
|
|
|
|
| 509 |
#kein Bild hochgeladen -> auf Text antworten...
|
| 510 |
status = "Antwort der KI ..."
|
| 511 |
if (file == None and file_history == None):
|
|
@@ -628,6 +630,7 @@ with gr.Blocks(css=custom_css(), theme=themeAlex) as demo:
|
|
| 628 |
attached_file = gr.State(None)
|
| 629 |
attached_file_history = gr.State(None)
|
| 630 |
attached_file3 = gr.State(None)
|
|
|
|
| 631 |
status_display = gr.State("")
|
| 632 |
status_display2 = gr.State("")
|
| 633 |
status_display3 = gr.State("")
|
|
@@ -873,6 +876,7 @@ with gr.Blocks(css=custom_css(), theme=themeAlex) as demo:
|
|
| 873 |
inputs=[
|
| 874 |
user_question3,
|
| 875 |
attached_file3,
|
|
|
|
| 876 |
chatbot_code,
|
| 877 |
history3,
|
| 878 |
model_option,
|
|
@@ -895,7 +899,7 @@ with gr.Blocks(css=custom_css(), theme=themeAlex) as demo:
|
|
| 895 |
|
| 896 |
# Chatbot
|
| 897 |
transfer_input_args3 = dict(
|
| 898 |
-
fn=add_text, inputs=[chatbot_code, history3, user_input3, attached_file3], outputs=[chatbot_code, history3, user_question3, attached_file3, image_display3, user_input3], show_progress=True
|
| 899 |
)
|
| 900 |
|
| 901 |
predict_event3_1 = user_input3.submit(**transfer_input_args3, queue=False,).then(**predict_args3)
|
|
|
|
| 502 |
|
| 503 |
#Funktion wird direkt aufgerufen aus der GUI - von hier muss auch die Rückmeldung kommen....
|
| 504 |
#man kann einen Text-Prompt eingeben , dazu ein Image hochladen, und dann dazu code erzeugen lassen
|
| 505 |
+
def generate_code(prompt_in, file, file_history, chatbot, history, 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,top_k=35):
|
| 506 |
#prompt normalisieren bevor er an die KIs geht
|
| 507 |
prompt = normalise_prompt(prompt_in)
|
| 508 |
+
#falls schon ein File hochgeladen wurde, ist es in history_file gespeichert - falls ein neues File hochgeladen wurde, wird es anschließend neu gesetzt
|
| 509 |
+
neu_file = file_history
|
| 510 |
+
|
| 511 |
#kein Bild hochgeladen -> auf Text antworten...
|
| 512 |
status = "Antwort der KI ..."
|
| 513 |
if (file == None and file_history == None):
|
|
|
|
| 630 |
attached_file = gr.State(None)
|
| 631 |
attached_file_history = gr.State(None)
|
| 632 |
attached_file3 = gr.State(None)
|
| 633 |
+
attached_file_history3 = gr.State(None)
|
| 634 |
status_display = gr.State("")
|
| 635 |
status_display2 = gr.State("")
|
| 636 |
status_display3 = gr.State("")
|
|
|
|
| 876 |
inputs=[
|
| 877 |
user_question3,
|
| 878 |
attached_file3,
|
| 879 |
+
attached_file_history3,
|
| 880 |
chatbot_code,
|
| 881 |
history3,
|
| 882 |
model_option,
|
|
|
|
| 899 |
|
| 900 |
# Chatbot
|
| 901 |
transfer_input_args3 = dict(
|
| 902 |
+
fn=add_text, inputs=[chatbot_code, history3, user_input3, attached_file3, attached_file_history3], outputs=[chatbot_code, history3, user_question3, attached_file3, attached_file_history3, image_display3, user_input3], show_progress=True
|
| 903 |
)
|
| 904 |
|
| 905 |
predict_event3_1 = user_input3.submit(**transfer_input_args3, queue=False,).then(**predict_args3)
|