import streamlit as st from transformers import pipeline import datetime import pandas as pd from pathlib import Path # to-do import upload st.markdown("# Chatbot") st.sidebar.markdown("# Chatbot") uploaded_file = '' # PLACEHOLDER # Display file content file_content = uploaded_file.read() st.write("Dateiinhalt:") st.code(file_content) # User input for question user_question = st.text_input("Stellen Sie eine Frage zum hochgeladenen PDF:") # Perform Hugging Face task (e.g., question answering) if user_question: question_answering = pipeline( "question-answering", model="deepset/gelectra-base-germanquad-distilled", tokenizer="deepset/gelectra-base-germanquad-distilled" ) # Get answer to the user's question answer = question_answering(question=user_question, context=file_content) # Display the answer to the user's question st.write(f"Antwort auf die Frage '{user_question}': {answer['answer']}") st.write("Confidence Score:", answer['score'])