alexkueck commited on
Commit
7c3b39d
1 Parent(s): 330fbb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -292,9 +292,10 @@ def generate_auswahl(prompt_in, file, file_history, chatbot, history, anzahl_doc
292
  summary += " ".join([
293
  '<div><b>Dokument: </b> <span style="color: #BB70FC;">' + str(doc['titel']) + '</span> '
294
  ' (<b>Seite:</b></span> <span style="color: red;">' + str(doc['seite']) + '</span>)<br>'
295
- '<span><b>Auschnitt:</b> ' + str(doc["content"]) + '</span></div>\n'
296
- for doc in results['relevant_docs']
297
- ])
 
298
  history = history + [[prompt_in, summary]]
299
 
300
  chatbot[-1][1] = summary
@@ -317,7 +318,11 @@ def generate_auswahl(prompt_in, file, file_history, chatbot, history, anzahl_doc
317
 
318
  else: #noch nicht validiert, oder kein Prompt
319
  return chatbot, history, None, file_history, "Erst validieren oder einen Prompt eingeben!"
320
-
 
 
 
 
321
 
322
 
323
  ########################################
@@ -345,7 +350,6 @@ def custom_css():
345
  #############################################################################################
346
  # Start Gui Vorabfrage
347
  # Validierungs-Interface - Bots weghalten...
348
- print ("Start GUI Vorabfrage")
349
  #################################################################################################
350
  print ("Start GUI Hauptanwendung")
351
  with open("custom.css", "r", encoding="utf-8") as f:
 
292
  summary += " ".join([
293
  '<div><b>Dokument: </b> <span style="color: #BB70FC;">' + str(doc['titel']) + '</span> '
294
  ' (<b>Seite:</b></span> <span style="color: red;">' + str(doc['seite']) + '</span>)<br>'
295
+ '<span><b>Auschnitt:</b> ' + str(doc["content"]) + '</span></div>'
296
+ '<div><span><b>Link: </b><span style="color: #BB70FC;">' + str(download_link(doc)) + '</span></div>'
297
+ for doc in results['relevant_docs']])
298
+
299
  history = history + [[prompt_in, summary]]
300
 
301
  chatbot[-1][1] = summary
 
318
 
319
  else: #noch nicht validiert, oder kein Prompt
320
  return chatbot, history, None, file_history, "Erst validieren oder einen Prompt eingeben!"
321
+
322
+ def download_link(doc_name):
323
+ # URL für das Herunterladen der Datei
324
+ file_url = f"https://huggingface.co/spaces/alexkueck/kkg_suche/resolve/main/kkg_dokumente/{doc_name}?token={HF_READ}"
325
+ return f'<b><a href="{file_url}" target="_blank" style="color: #BB70FC; font-weight: bold;">{doc_name}</a></b>'
326
 
327
 
328
  ########################################
 
350
  #############################################################################################
351
  # Start Gui Vorabfrage
352
  # Validierungs-Interface - Bots weghalten...
 
353
  #################################################################################################
354
  print ("Start GUI Hauptanwendung")
355
  with open("custom.css", "r", encoding="utf-8") as f: