File size: 1,018 Bytes
ff1f92b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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'])