File size: 824 Bytes
65f41e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
from gradio_client import Client

client = Client("https://ruslanmv-ai-medical-chatbot.hf.space/--replicas/93n5n/")
result = client.predict(
		"Howdy!",	# str  in 'Input Prompt' Textbox component
		fn_index=0
)
print(result)





import requests

API_URL = "https://api-inference.huggingface.co/models/dmis-lab/biobert-base-cased-v1.1"
headers = {"Authorization": "Bearer YOUR_HUGGING_FACE_API_KEY"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

# Example query
data = {
    "inputs": {
        "question": "What are the symptoms of COVID-19?",
        "context": "COVID-19 symptoms include fever, dry cough, and tiredness. Some patients may have aches and pains, nasal congestion, sore throat or diarrhea."
    }
}

result = query(data)
print(result)