Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
|
|
|
|
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 |
-
|
|
|
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 |
|