Insura / app.py
NanditaVora's picture
Update app.py
3adf53a verified
raw
history blame contribute delete
658 Bytes
import streamlit as st
# x = st.slider('Select a value')
# st.write(x, 'squared is', x * x)
from datasets import load_dataset
dataset = load_dataset("soulhq-ai/insuranceQA-v2")
import requests
import os
API_KEY = os.environ.get("API_KEY")
API_URL = "https://api-inference.huggingface.co/models/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad"
headers = {"Authorization": "Bearer " + API_KEY}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
"inputs": {
"question": "What is my name?",
"context": dataset
}
})
st.write(output.answer)