wedo2910 commited on
Commit
9edd3a8
·
verified ·
1 Parent(s): 1598ad8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -27,6 +27,11 @@ default_settings = {
27
  "doc_stride": 128,
28
  }
29
 
 
 
 
 
 
30
  # Streamlit UI
31
  st.title("Arabic AI Question Answering")
32
  st.subheader("Ask a question to get an answer.")
@@ -52,10 +57,10 @@ if st.button("Get Answer"):
52
  if not question:
53
  st.error("The question field is required.")
54
  else:
55
- # Generate answer
56
  try:
57
  prediction = qa_pipeline(
58
- {"question": question},
59
  max_answer_len=max_answer_len,
60
  doc_stride=doc_stride
61
  )
 
27
  "doc_stride": 128,
28
  }
29
 
30
+ # Define a default context (e.g., a general knowledge text or topic)
31
+ default_context = """
32
+ التزم بنص السؤال.
33
+ """
34
+
35
  # Streamlit UI
36
  st.title("Arabic AI Question Answering")
37
  st.subheader("Ask a question to get an answer.")
 
57
  if not question:
58
  st.error("The question field is required.")
59
  else:
60
+ # Generate answer using the default context
61
  try:
62
  prediction = qa_pipeline(
63
+ {"context": default_context, "question": question},
64
  max_answer_len=max_answer_len,
65
  doc_stride=doc_stride
66
  )