Update pages/bot.py
Browse files- pages/bot.py +8 -5
pages/bot.py
CHANGED
|
@@ -95,20 +95,23 @@ def main():
|
|
| 95 |
question=user_question
|
| 96 |
st.text(user_question)
|
| 97 |
context=""+retrieved_docs[0].page_content+retrieved_docs[1].page_content+retrieved_docs[3].page_content
|
| 98 |
-
context=context.replace("\n", " ")
|
| 99 |
-
st.text("Das ist der
|
| 100 |
st.text(context)
|
| 101 |
|
| 102 |
# Erstelle die Question Answering-Pipeline für Deutsch
|
| 103 |
qa_pipeline = pipeline("question-answering", model="deutsche-telekom/bert-multi-english-german-squad2", tokenizer="deutsche-telekom/bert-multi-english-german-squad2")
|
| 104 |
|
| 105 |
# Frage beantworten
|
| 106 |
-
answer = qa_pipeline(question=question, context=context, top_k=3)
|
|
|
|
| 107 |
|
| 108 |
# Gib die Antwort aus
|
| 109 |
st.text("Basisantwort:")
|
| 110 |
-
|
| 111 |
-
st.text(answer)
|
|
|
|
|
|
|
| 112 |
|
| 113 |
|
| 114 |
if __name__ == '__main__':
|
|
|
|
| 95 |
question=user_question
|
| 96 |
st.text(user_question)
|
| 97 |
context=""+retrieved_docs[0].page_content+retrieved_docs[1].page_content+retrieved_docs[3].page_content
|
| 98 |
+
context=context.replace("\n", " ")
|
| 99 |
+
st.text("Das ist der Textausschnitt der durch den Retriever herausgesucht wird:")
|
| 100 |
st.text(context)
|
| 101 |
|
| 102 |
# Erstelle die Question Answering-Pipeline für Deutsch
|
| 103 |
qa_pipeline = pipeline("question-answering", model="deutsche-telekom/bert-multi-english-german-squad2", tokenizer="deutsche-telekom/bert-multi-english-german-squad2")
|
| 104 |
|
| 105 |
# Frage beantworten
|
| 106 |
+
#answer = qa_pipeline(question=question, context=context, top_k=3)
|
| 107 |
+
answer = qa_pipeline(question=question, context=context)
|
| 108 |
|
| 109 |
# Gib die Antwort aus
|
| 110 |
st.text("Basisantwort:")
|
| 111 |
+
st.text(answer["answer"])
|
| 112 |
+
#st.text(answer)
|
| 113 |
+
|
| 114 |
+
#Die Basisantwort müsste man jetzt ausformulieren
|
| 115 |
|
| 116 |
|
| 117 |
if __name__ == '__main__':
|