|
import streamlit as st |
|
from transformers import pipeline |
|
import datetime |
|
import pandas as pd |
|
from pathlib import Path |
|
|
|
|
|
|
|
st.markdown("# Chatbot") |
|
st.sidebar.markdown("# Chatbot") |
|
|
|
uploaded_file = '' |
|
|
|
|
|
file_content = uploaded_file.read() |
|
st.write("Dateiinhalt:") |
|
st.code(file_content) |
|
|
|
|
|
user_question = st.text_input("Stellen Sie eine Frage zum hochgeladenen PDF:") |
|
|
|
|
|
|
|
if user_question: |
|
question_answering = pipeline( |
|
"question-answering", |
|
model="deepset/gelectra-base-germanquad-distilled", |
|
tokenizer="deepset/gelectra-base-germanquad-distilled" |
|
) |
|
|
|
|
|
answer = question_answering(question=user_question, context=file_content) |
|
|
|
|
|
st.write(f"Antwort auf die Frage '{user_question}': {answer['answer']}") |
|
st.write("Confidence Score:", answer['score']) |