Space gives import error and unbound local error.

#1
by denizsincar29 - opened

Hello all! Tried to use the space via API but i get many strange errors:

  1. If you send 2 messages in 1 connection, on the second prediction gradio will raise an exception that server returned unbound local error. If you send a video with text, server yields an import error.

Steps to reproduce:
Run this code:

from gradio_client import Client, handle_file

class ChatBot:
    def __init__(self):
        self.client = Client("HuggingFaceTB/SmolVLM2")
    

    def chat(self, message, files=[], max_tokens=1000):
        msg = {"text": message}
        if files:
            msg["files"] = [handle_file(file) for file in files]
        response = self.client.predict(msg, param_2=max_tokens, api_name="/chat")
        return response


if __name__ == "__main__":
    chatbot = ChatBot()
    message = "Hi! I want to test you if you remember chat history. Save my name as Deniz Sincar."
    response = chatbot.chat(message)
    print(response)
    message = "Do you rememberWhat is my name?"
    response = chatbot.chat(message)  # unbound local error
    print(response)

@denizsincar29 the demo spaces inference doesn't have contextual memory or a history of the chat/uploaded media function in the backend.

Hello! Is there some work about this? Same error and same issue!

I built a local standalone repo that has contextual memory, a whole bunch of other features which really boosts it's understanding, performance & outputs as well as a UI upgrade. I plan on releasing it next weekend, perhaps sooner. [Need to integrate an additional feature I've been tinkering w/, convert the build to a huggingface space demo, add documentation on how it works & then link it to the github repo]. When I finish everything, I'll ping you here to let you know it's live & where to find it!

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment