API of working gradio App responding with empty error
I have trained a model for Image classification and I am trying to host it on huggingface. The gradio app I made works fine but the minimal JS API example does not even work. I am following a tutorial from Jeremy Howard, and everything looks so straight forward, but wont work in the huggingface space I am using. I think this may have something to do with the job queue that should handle my API calls?Please someone point me in the right direction I could not find anything on this problem on the forum or in the documentation.Thank you all in advance.my code:# %% ModelTester.ipynb 1
from fastai.vision.all import *
import gradio as gr

# %% ModelTester.ipynb 3
from fastai.metrics import Metric

class OrdinalRegressionMetric(Metric):
    def __init__(self):
        super().__init__()
        self.total = 0
        self.count = 0

    def accumulate(self, learn):
        # Get predictions and targets
        preds, targs = learn.pred, learn.y

        # Your custom logic to convert predictions and targets to numeric values
        preds_numeric = torch.argmax(preds, dim=1)
        targs_numeric = targs

        # Calculate the metric (modify this based on your specific needs)
        squared_diff = torch.sum(torch.sqrt((preds_numeric - targs_numeric)**2))

        # Normalize by the maximum possible difference
        max_diff = torch.sqrt((torch.max(targs_numeric) - torch.min(targs_numeric))**2)

        # Update the metric value
        self.total += squared_diff
        #print("self.total: ",self.total)
        self.count += max_diff
        #print("self.count: ",self.count)
    @property
    def value(self):
        if self.count == 0:
            return 0.0  # or handle this case appropriately
        # Calculate the normalized metric value
        metric_value = 1/(self.total / self.count)
        return metric_value

# %% ModelTester.ipynb 4
learn = load_learner("textfile3-2.pk1")

# %% ModelTester.ipynb 6
categories = ("1","1-2","2","2-3","3","3-4","4","4-5","5")

def classify_image(img):
    pred, idx, probs = learn.predict(img)
    return dict(zip(categories, map(float, probs)))

# %% ModelTester.ipynb 8

intf = gr.Interface(fn=classify_image, inputs='image', outputs='label')
intf.launch(inline=False)the generated API example:import { client } from "@gradio/client";

const response_0 = await fetch("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png");
const exampleImage = await response_0.blob();
						
const app = await client("https://beelzeebuub-fjgradiominimal.hf.space/--replicas/3xqpt/");
const result = await app.predict("/predict", [
				exampleImage, 	// blob in 'img' Image component
	]);

console.log(result.data);`The log from my gradio app:===== Application Startup at 2024-01-08 09:39:00 =====Running on local URL:http://0.0.0.0:7860To create a public link, setshare=Trueinlaunch()./home/user/.local/lib/python3.10/site-packages/fastai/torch_core.py:263: UserWarning: ‘has_mps’ is deprecated, please use ‘torch.backends.mps.is_built()’return getattr(torch, ‘has_mps’, False)Traceback (most recent call last):File “/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py”, line 489, in call_predictionoutput = await route_utils.call_process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_apioutput = await app.get_blocks().process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_apiinputs = self.preprocess_data(fn_index, inputs, state)File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_datainputs_cached = block.data_model(**inputs_cached)  # type: ignoreFile “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, ininitpydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)pydantic_core._pydantic_core.ValidationError: 1 validation error for FileDatapathField required [type=missing, input_value={}, input_type=dict]For further information visitRedirecting...===== Application Startup at 2024-01-08 09:39:00 =====Running on local URL:http://0.0.0.0:7860To create a public link, setshare=Trueinlaunch()./home/user/.local/lib/python3.10/site-packages/fastai/torch_core.py:263: UserWarning: ‘has_mps’ is deprecated, please use ‘torch.backends.mps.is_built()’return getattr(torch, ‘has_mps’, False)Traceback (most recent call last):File “/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py”, line 489, in call_predictionoutput = await route_utils.call_process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_apioutput = await app.get_blocks().process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_apiinputs = self.preprocess_data(fn_index, inputs, state)File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_datainputs_cached = block.data_model(**inputs_cached)  # type: ignoreFile “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, ininitpydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)pydantic_core._pydantic_core.ValidationError: 1 validation error for FileDatapathField required [type=missing, input_value={}, input_type=dict]For further information visitRedirecting...===== Application Startup at 2024-01-08 09:39:00 =====Running on local URL:http://0.0.0.0:7860To create a public link, setshare=Trueinlaunch()./home/user/.local/lib/python3.10/site-packages/fastai/torch_core.py:263: UserWarning: ‘has_mps’ is deprecated, please use ‘torch.backends.mps.is_built()’return getattr(torch, ‘has_mps’, False)Traceback (most recent call last):File “/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py”, line 489, in call_predictionoutput = await route_utils.call_process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_apioutput = await app.get_blocks().process_api(File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_apiinputs = self.preprocess_data(fn_index, inputs, state)File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_datainputs_cached = block.data_model(**inputs_cached)  # type: ignoreFile “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, ininitpydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)pydantic_core._pydantic_core.ValidationError: 1 validation error for FileDatapathField required [type=missing, input_value={}, input_type=dict]For further information visitRedirecting...The Response from the API:Uncaught (in promise)Object { type: “status”, endpoint: “/predict”, fn_index: 0, time: Date Mon Jan 08 2024 10:37:41 GMT+0100 (Central European Standard Time), queue: true, message: null, stage: “error”, code: undefined, success: false }runtime-core.esm-bundler.js:221:6logError runtime-core.esm-bundler.js:221handleError runtime-core.esm-bundler.js:208callWithAsyncErrorHandling runtime-core.esm-bundler.js:169(Async: promise callback)callWithAsyncErrorHandling runtime-core.esm-bundler.js:168invoker runtime-dom.esm-bundler.js:595(Async: EventListener.handleEvent)addEventListener runtime-dom.esm-bundler.js:549patchEvent runtime-dom.esm-bundler.js:564patchProp runtime-dom.esm-bundler.js:628mountElement runtime-core.esm-bundler.js:5297processElement runtime-core.esm-bundler.js:5244patch runtime-core.esm-bundler.js:5116mountChildren runtime-core.esm-bundler.js:5372mountElement runtime-core.esm-bundler.js:5279processElement runtime-core.esm-bundler.js:5244patch runtime-core.esm-bundler.js:5116componentUpdateFn runtime-core.esm-bundler.js:5796run reactivity.esm-bundler.js:178update runtime-core.esm-bundler.js:5902setupRenderEffect runtime-core.esm-bundler.js:5910mountComponent runtime-core.esm-bundler.js:5700processComponent runtime-core.esm-bundler.js:5653patch runtime-core.esm-bundler.js:5128componentUpdateFn runtime-core.esm-bundler.js:5861run reactivity.esm-bundler.js:178update runtime-core.esm-bundler.js:5902callWithErrorHandling runtime-core.esm-bundler.js:158flushJobs runtime-core.esm-bundler.js:365(Async: promise callback)queueFlush runtime-core.esm-bundler.js:275queueJob runtime-core.esm-bundler.js:269effect runtime-core.esm-bundler.js:5898triggerEffect reactivity.esm-bundler.js:373triggerEffects reactivity.esm-bundler.js:363triggerRefValue reactivity.esm-bundler.js:971effect reactivity.esm-bundler.js:1128triggerEffect reactivity.esm-bundler.js:373triggerEffects reactivity.esm-bundler.js:358triggerRefValue reactivity.esm-bundler.js:971effect reactivity.esm-bundler.js:1128triggerEffect reactivity.esm-bundler.js:373triggerEffects reactivity.esm-bundler.js:358triggerRefValue reactivity.esm-bundler.js:971effect reactivity.esm-bundler.js:1128triggerEffect reactivity.esm-bundler.js:373triggerEffects reactivity.esm-bundler.js:358triggerRefValue reactivity.esm-bundler.js:971effect reactivity.esm-bundler.js:1128triggerEffect reactivity.esm-bundler.js:373triggerEffects reactivity.esm-bundler.js:358triggerRefValue reactivity.esm-bundler.js:971set value reactivity.esm-bundler.js:1015finalizeNavigation vue-router.mjs:3353pushWithRedirect vue-router.mjs:3218(Async: promise callback)pushWithRedirect vue-router.mjs:3185push vue-router.mjs:3110install vue-router.mjs:3551use runtime-core.esm-bundler.js:3786main.js:12