MiniGPT-4
MiniGPT-4 copied to clipboard
Error while trying to use the gradio_client API (AttributeError: 'dict' object has no attribute 'replace')
Congratulations on this fantastic job! I am trying to use the model with the gradio_client API (while the model is running on colab according to the colab tutorial)
Using the code from the API DOC:
========================== from gradio_client import Client
client = Client("https://158ba9997c4a402c80.gradio.live/") result = client.predict( "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str representing filepath or URL to image in 'parameter_6' Image component "Howdy!", # str representing string value in 'User' Textbox component #null, # Any representing in 'parameter_13' State component fn_index=0 ) print(result)
I am getting the following error: AttributeError: 'dict' object has no attribute 'replace'
Could you please help me fix this problem?
Sincerely, Alexandros Xenos
Hi Alexandros, I am getting the exact same issue. Did you happen to find a solution? Thanks.
Hi Nathan, unfortunately not :(
Same issue here -- anyone find a workaround?
Using the code from the API DOC:
Sorry if I totally missed it, but where is the API doc? Looking for the schema currently.
from gradio_client import Client
client = Client("Your_Public_URL")
# print(client.view_api(all_endpoints=True)) # uncomment this line to view all available API
client.submit("You_Test_Image.png", "describe the image", fn_index=0)
_, chatbot = client.predict("describe the image", "empty.json", fn_index=1)
chatbot = client.predict(chatbot, 1, 1, fn_index=2)
print(chatbot)
I think you can try this code to use the gradio_client API to call the miniGPT predict function. The empty.json is an json file with only "[]". The chatbot will be a json file path which save the conversation.
client = Client("xxx", serialize=False)
don't serialize
client = Client("xxx", serialize=False)
don't serialize
Solved my problem, thank you!
Still getting the same error even with serialize=False
+1
Try this for MiniGPT V1:
@wushaojun321 @TsuTikgiau @junchen14 I was able to use gradio_client with MiniGPT (see above comment). But it's not very clear on how to do this with MiniGPT v2 w/ LLaMa. Could you please provide a minimum viable script/steps to achieve this? Your help would be highly appreciated! Thanks!
Still getting the same error even with serialize=False
After 'serialize=False', I've met the same issue in https://huggingface.co/spaces/Vision-CAIR/minigpt4/discussions/32
Im having the same issue
非常不幸,我也遇到了相同的问题。我使用vscode连接linux服务器,运行后使用api,出现了相同的问题。使用“serialize=False”,也没有解决问题。