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:7860

To create a public link, set share=True in launch().
/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_prediction
output = await route_utils.call_process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_api
output = await app.get_blocks().process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_data
inputs_cached = block.data_model(**inputs_cached) # type: ignore
File “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for FileData
path
Field required [type=missing, input_value={}, input_type=dict]
For further information visit Redirecting...
===== Application Startup at 2024-01-08 09:39:00 =====

Running on local URL: http://0.0.0.0:7860

To create a public link, set share=True in launch().
/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_prediction
output = await route_utils.call_process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_api
output = await app.get_blocks().process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_data
inputs_cached = block.data_model(**inputs_cached) # type: ignore
File “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for FileData
path
Field required [type=missing, input_value={}, input_type=dict]
For further information visit Redirecting...
===== Application Startup at 2024-01-08 09:39:00 =====

Running on local URL: http://0.0.0.0:7860

To create a public link, set share=True in launch().
/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_prediction
output = await route_utils.call_process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py”, line 232, in call_process_api
output = await app.get_blocks().process_api(
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1531, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File “/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py”, line 1307, in preprocess_data
inputs_cached = block.data_model(**inputs_cached) # type: ignore
File “/home/user/.local/lib/python3.10/site-packages/pydantic/main.py”, line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for FileData
path
Field required [type=missing, input_value={}, input_type=dict]
For further information visit Redirecting...

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:6
logError runtime-core.esm-bundler.js:221
handleError runtime-core.esm-bundler.js:208
callWithAsyncErrorHandling runtime-core.esm-bundler.js:169
(Async: promise callback)
callWithAsyncErrorHandling runtime-core.esm-bundler.js:168
invoker runtime-dom.esm-bundler.js:595
(Async: EventListener.handleEvent)
addEventListener runtime-dom.esm-bundler.js:549
patchEvent runtime-dom.esm-bundler.js:564
patchProp runtime-dom.esm-bundler.js:628
mountElement runtime-core.esm-bundler.js:5297
processElement runtime-core.esm-bundler.js:5244
patch runtime-core.esm-bundler.js:5116
mountChildren runtime-core.esm-bundler.js:5372
mountElement runtime-core.esm-bundler.js:5279
processElement runtime-core.esm-bundler.js:5244
patch runtime-core.esm-bundler.js:5116
componentUpdateFn runtime-core.esm-bundler.js:5796
run reactivity.esm-bundler.js:178
update runtime-core.esm-bundler.js:5902
setupRenderEffect runtime-core.esm-bundler.js:5910
mountComponent runtime-core.esm-bundler.js:5700
processComponent runtime-core.esm-bundler.js:5653
patch runtime-core.esm-bundler.js:5128
componentUpdateFn runtime-core.esm-bundler.js:5861
run reactivity.esm-bundler.js:178
update runtime-core.esm-bundler.js:5902
callWithErrorHandling runtime-core.esm-bundler.js:158
flushJobs runtime-core.esm-bundler.js:365
(Async: promise callback)
queueFlush runtime-core.esm-bundler.js:275
queueJob runtime-core.esm-bundler.js:269
effect runtime-core.esm-bundler.js:5898
triggerEffect reactivity.esm-bundler.js:373
triggerEffects reactivity.esm-bundler.js:363
triggerRefValue reactivity.esm-bundler.js:971
effect reactivity.esm-bundler.js:1128
triggerEffect reactivity.esm-bundler.js:373
triggerEffects reactivity.esm-bundler.js:358
triggerRefValue reactivity.esm-bundler.js:971
effect reactivity.esm-bundler.js:1128
triggerEffect reactivity.esm-bundler.js:373
triggerEffects reactivity.esm-bundler.js:358
triggerRefValue reactivity.esm-bundler.js:971
effect reactivity.esm-bundler.js:1128
triggerEffect reactivity.esm-bundler.js:373
triggerEffects reactivity.esm-bundler.js:358
triggerRefValue reactivity.esm-bundler.js:971
effect reactivity.esm-bundler.js:1128
triggerEffect reactivity.esm-bundler.js:373
triggerEffects reactivity.esm-bundler.js:358
triggerRefValue reactivity.esm-bundler.js:971
set value reactivity.esm-bundler.js:1015
finalizeNavigation vue-router.mjs:3353
pushWithRedirect vue-router.mjs:3218
(Async: promise callback)
pushWithRedirect vue-router.mjs:3185
push vue-router.mjs:3110
install vue-router.mjs:3551
use runtime-core.esm-bundler.js:3786
main.js:12