File size: 586 Bytes
089621c
36d951c
089621c
 
 
 
 
 
 
 
 
 
 
daa3b24
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()