File size: 658 Bytes
f88fbd6
2c7681b
bf0ec85
 
ec12d72
3adf53a
ec12d72
3adf53a
bf0ec85
87170cd
a2fef77
 
 
bf0ec85
f90f3a6
74daf61
bf0ec85
87170cd
 
 
 
 
e908b21
3adf53a
 
e908b21
f88fbd6
 
3adf53a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)