API question

#2
by brohamulus - opened

What are the tasks for this model? It would be great to have an example. It seems the ticket, Date, n_weeks, and Use Latest Basic Financials would be the inputs with values. https://github.com/AI4Finance-Foundation/FinGPT/blob/master/fingpt/FinGPT_Forecaster/README.md has the following inputs, but not sure how to use that to pass into the query to get output that has the "Information" and "Response" seen in the HuggingFace UI. Thanks.

inputs = {key: value.to(model.device) for key, value in inputs.items()}

Python code example that does not work:
import requests
API_URL = "https://api-inference.huggingface.co/models/FinGPT/fingpt-forecaster_dow30_llama2-7b_lora"
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
data = query({"inputs": "key: AAPL"})
print(data)
{'error': 'Task not found for this model'}

FinGPT org

Checkout the source code for the fingpt-forecaster gradio space. Follow the "predict" function and check out if this is what you want.

Sign up or log in to comment