Update utils.py
Browse files
utils.py
CHANGED
@@ -575,24 +575,7 @@ def download_link(doc):
|
|
575 |
file_url = f"https://huggingface.co/spaces/alexkueck/SucheRAG/resolve/main/{doc}?token=hf_token"
|
576 |
return f'<b><a href="{file_url}" target="_blank" style="color: #BB70FC; font-weight: bold;">{doc}</a></b>'
|
577 |
|
578 |
-
|
579 |
-
def upload_pdf(file):
|
580 |
-
if file is None:
|
581 |
-
return None, "Keine Datei hochgeladen."
|
582 |
-
|
583 |
-
# Extrahieren des Dateinamens aus dem vollen Pfad
|
584 |
-
filename = os.path.basename(file.name)
|
585 |
-
|
586 |
-
# Datei zum Hugging Face Space hochladen
|
587 |
-
upload_path = f"chroma/kkg/pdf/{filename}"
|
588 |
-
api.upload_file(
|
589 |
-
path_or_fileobj=file.name,
|
590 |
-
path_in_repo=upload_path,
|
591 |
-
repo_id=REPO_ID,
|
592 |
-
repo_type=REPO_TYPE,
|
593 |
-
token=HF_WRITE
|
594 |
-
)
|
595 |
-
return f"PDF '{filename}' erfolgreich hochgeladen."
|
596 |
|
597 |
def display_files():
|
598 |
files = os.listdir(DOCS_DIR)
|
|
|
575 |
file_url = f"https://huggingface.co/spaces/alexkueck/SucheRAG/resolve/main/{doc}?token=hf_token"
|
576 |
return f'<b><a href="{file_url}" target="_blank" style="color: #BB70FC; font-weight: bold;">{doc}</a></b>'
|
577 |
|
578 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
|
580 |
def display_files():
|
581 |
files = os.listdir(DOCS_DIR)
|