alexkueck commited on
Commit
aa80e7b
1 Parent(s): c05dd4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -114,14 +114,11 @@ def clear_all():
114
  def add_text(chatbot, history, prompt, file):
115
  if (file == None):
116
  chatbot = chatbot +[(prompt, None)]
117
- history = history +[(prompt, None)]
118
  else:
119
  if (prompt == ""):
120
  chatbot=chatbot + [((file.name,), "Prompt fehlt!")]
121
- history=history + [((file.name,), "Prompt fehlt!")]
122
  else:
123
  chatbot = chatbot +[((file.name,), None), (prompt, None)]
124
- history = history +[((file.name,), None), (prompt, None)]
125
 
126
  return chatbot, history, prompt, file, gr.Image(visible = False), "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
127
 
@@ -229,7 +226,7 @@ def generate_auswahl(prompt, file, chatbot, history, rag_option, model_option, o
229
  #kein Bild hochgeladen -> auf Text antworten...
230
  if (file == None):
231
  result = 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,)
232
- #history = history + [(prompt, result)]
233
  else:
234
  #Es wurde ein Bild angehängt -> wenn prompt dazu, das Bild analysieren
235
  #geht nur über spezielle OpenAI-Schnittstelle...
@@ -239,10 +236,9 @@ def generate_auswahl(prompt, file, chatbot, history, rag_option, model_option, o
239
  else:
240
  result = generate_text_zu_doc(file, prompt, k, rag_option, chatbot)
241
 
242
- #history = history + [((file,), None),(prompt, result)]
243
 
244
  chatbot[-1][1] = ""
245
- history[-1][1] = ""
246
  for character in result:
247
  chatbot[-1][1] += character
248
  history[-1][1] += character
 
114
  def add_text(chatbot, history, prompt, file):
115
  if (file == None):
116
  chatbot = chatbot +[(prompt, None)]
 
117
  else:
118
  if (prompt == ""):
119
  chatbot=chatbot + [((file.name,), "Prompt fehlt!")]
 
120
  else:
121
  chatbot = chatbot +[((file.name,), None), (prompt, None)]
 
122
 
123
  return chatbot, history, prompt, file, gr.Image(visible = False), "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
124
 
 
226
  #kein Bild hochgeladen -> auf Text antworten...
227
  if (file == None):
228
  result = 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,)
229
+ history = history + [(prompt, result)]
230
  else:
231
  #Es wurde ein Bild angehängt -> wenn prompt dazu, das Bild analysieren
232
  #geht nur über spezielle OpenAI-Schnittstelle...
 
236
  else:
237
  result = generate_text_zu_doc(file, prompt, k, rag_option, chatbot)
238
 
239
+ history = history + [((file,), None),(prompt, result)]
240
 
241
  chatbot[-1][1] = ""
 
242
  for character in result:
243
  chatbot[-1][1] += character
244
  history[-1][1] += character