htafer commited on
Commit
2ca54f8
1 Parent(s): aea3c48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -15,7 +15,7 @@ from tempfile import NamedTemporaryFile
15
  import re
16
  def main():
17
  # Initialize the Streamlit app
18
- st.title('Document-Based Q&A System')
19
 
20
  # API Key input securely, API KEY defined in settings
21
  # api_key = st.text_input("Enter your OpenAI API key:", type="password")
@@ -26,7 +26,7 @@ def main():
26
 
27
 
28
  # File uploader
29
- uploaded_file = st.file_uploader("Upload your document", type=['txt'])
30
  if uploaded_file is not None:
31
  # Read and process the document
32
  with NamedTemporaryFile(delete=False) as f:
@@ -61,12 +61,12 @@ def main():
61
  )
62
 
63
  # Question input
64
- query = st.text_input("Ask a question about the document:")
65
  if query:
66
  result = conversation_chain({"question": query})
67
  answer = result["answer"]
68
- st.write("Answer:", answer)
69
- st.write("Source documents:")
70
  for i in result["source_documents"]:
71
  res = re.search(r'^[^\n]*', i.page_content)
72
  st.write(i.page_content[res.span()[0]:res.span()[1]])
 
15
  import re
16
  def main():
17
  # Initialize the Streamlit app
18
+ st.title('Dokument-basiertes Q&A System')
19
 
20
  # API Key input securely, API KEY defined in settings
21
  # api_key = st.text_input("Enter your OpenAI API key:", type="password")
 
26
 
27
 
28
  # File uploader
29
+ uploaded_file = st.file_uploader("Dokument hochladen", type=['txt'])
30
  if uploaded_file is not None:
31
  # Read and process the document
32
  with NamedTemporaryFile(delete=False) as f:
 
61
  )
62
 
63
  # Question input
64
+ query = st.text_input("Frag deinen Dokumenten!")
65
  if query:
66
  result = conversation_chain({"question": query})
67
  answer = result["answer"]
68
+ st.write("Antwort:", answer)
69
+ st.write("Quellen:")
70
  for i in result["source_documents"]:
71
  res = re.search(r'^[^\n]*', i.page_content)
72
  st.write(i.page_content[res.span()[0]:res.span()[1]])