Sparrow / sparrow_parse /vllm /inference_base.py
Zana897465's picture
Upload 24 files
05e6f93 verified
raw
history blame contribute delete
820 Bytes
from abc import ABC, abstractmethod
import json
class ModelInference(ABC):
@abstractmethod
def inference(self, input_data, mode=None):
"""This method should be implemented by subclasses."""
pass
def get_simple_json(self):
# Define a simple data structure
data = {
"table": [
{
"description": "Revenues",
"latest_amount": 12453,
"previous_amount": 11445
},
{
"description": "Operating expenses",
"latest_amount": 9157,
"previous_amount": 8822
}
]
}
# Convert the dictionary to a JSON string
json_data = json.dumps(data, indent=4)
return json_data