luogen1996 / LaVIN

[NeurIPS 2023] Official implementations of "Cheap and Quick: Efficient Vision-Language Instruction Tuning for Large Language Models"
502 stars 36 forks source link

I would like to execute "gradio_client" reference #35

Open choibigo opened 10 months ago

choibigo commented 10 months ago

image

I found this reference in your demo

i try to execute from this method with below code

from gradio_client import Client

client = Client("http://127.0.0.1:7860/")
result = client.predict(
        "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath on your computer (or URL) of image) in 'parameter_5' Image component
        "Howdy!",   # str  in 'User' Textbox component
        fn_index=0
)
print(result)

But i got this error

Traceback (most recent call last):
  File "/home/cbigo/workspace/LaVIN/my_test.py", line 4, in <module>
    result = client.predict(
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 292, in predict
    return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 1131, in result
    return super().result(timeout=timeout)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 799, in _inner
    predictions = self.process_predictions(*predictions)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 991, in process_predictions
    predictions = self.deserialize(*predictions)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 977, in deserialize
    [
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/client.py", line 978, in <listcomp>
    s.deserialize(
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/serializing.py", line 206, in deserialize
    file = utils.decode_base64_to_file(x, dir=save_dir)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/utils.py", line 449, in decode_base64_to_file
    data, extension = decode_base64_to_binary(encoding)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/utils.py", line 414, in decode_base64_to_binary
    extension = get_extension(encoding)
  File "/home/cbigo/anaconda3/envs/lavin/lib/python3.8/site-packages/gradio_client/utils.py", line 360, in get_extension
    encoding = encoding.replace("audio/wav", "audio/x-wav")
AttributeError: 'dict' object has no attribute 'replace'

I would like to execute this reference

Please tell me how to do it