aakarsh-yadav-tcgls
setting up api calling
4340d95
raw
history blame contribute delete
586 Bytes
import requests
import gradio as gr
API_URL = "https://api-inference.huggingface.co/models/yiyanghkust/finbert-tone"
headers = {"Authorization": "Bearer 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"}
# Replace "your_input_data" with the actual data you want to send to your model
input_data = {"inputs": "your_input_data"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
def predict(text):
output = query({"inputs": text})
return output
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
iface.launch()