merve HF staff commited on
Commit
dee57fc
β€’
1 Parent(s): 0bb8bac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -52,10 +52,13 @@ st.write("You can check out this [link](https://huggingface.co/models?pipeline_t
52
  st.subheader("Easy Information Retrieval 🧩")
53
  st.write("If you're making a chatbot that needs to provide information to user, you can take user's query and search for the answer in the documents you have, using question answering models. Look at the example and try it yourself here πŸ‘‡πŸ»")
54
 
55
- qa_model = pipeline("question-answering")
 
 
56
  question = st.text_area(label = "Question", value = "What does transformers do?", height = 5)
57
  context = st.text_area(label = "Context", value = "πŸ€— Transformers provides thousands of pretrained models to perform tasks on different modalities such as text, vision, and audio.")
58
- output_answer = qa_model(question = question, context = context)
 
59
  st.write("Answer:")
60
  st.write(output_answer["answer"])
61
 
 
52
  st.subheader("Easy Information Retrieval 🧩")
53
  st.write("If you're making a chatbot that needs to provide information to user, you can take user's query and search for the answer in the documents you have, using question answering models. Look at the example and try it yourself here πŸ‘‡πŸ»")
54
 
55
+
56
+
57
+ model_id_q = "distilbert-base-cased-distilled-squad"
58
  question = st.text_area(label = "Question", value = "What does transformers do?", height = 5)
59
  context = st.text_area(label = "Context", value = "πŸ€— Transformers provides thousands of pretrained models to perform tasks on different modalities such as text, vision, and audio.")
60
+ data = {"inputs": {"question": question, "context": context}}
61
+ output_answer = query(payload = data, model_id = model_id_q, api_token = api_token)
62
  st.write("Answer:")
63
  st.write(output_answer["answer"])
64