Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining bug from #7317 - file path resolution wrong #7724

Closed
1 task done
skye0402 opened this issue Mar 17, 2024 · 10 comments · Fixed by #7787
Closed
1 task done

Remaining bug from #7317 - file path resolution wrong #7724

skye0402 opened this issue Mar 17, 2024 · 10 comments · Fixed by #7787
Assignees
Labels
bug Something isn't working cloud Issues that only happen when deploying Gradio on cloud services needs repro Awaiting full reproduction

Comments

@skye0402
Copy link

Describe the bug

With the correction of bug #7317 it's possible again from release 4.21.0 to work behind an application router. That's great. I recently discovered that the file path for pictures in a chatbot interface (at least that, maybe others as well) is not correct. Can you fix it?

Running local:
image
No issues. As you can see the path looks correct.

Running behind approuter:
image

The issue is the URL.

Used in the first reference:
https://apachat.c-290ae5b.kyma.shoot.live.k8s-hana./file=/tmp/gradio/8002ab707d333733cb66b8e9241218143955df1d/20220922063344.jpeg

Used in the second reference:
https://apachat.c-290ae5b.kyma.shoot.live.k8s-hana.o/file=/tmp/gradio/8002ab707d333733cb66b8e9241218143955df1d/20220922063344.jpeg

Correct:
https://apachat.c-290ae5b.kyma.shoot.live.k8s-hana.ondemand.com/file=/tmp/gradio/8002ab707d333733cb66b8e9241218143955df1d/20220922063344.jpeg

Somehow the last 2 parts of the domain name are cut off. Interesting is that the first is cut after the dot while the second shows the "o" of "ondemand". Can you check that please?

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

Screenshot

No response

Logs

No response

System Info

Gradio 4.21.0 (upgraded from 4.16.0 where it still worked).

Severity

Blocking usage of gradio

@skye0402 skye0402 added the bug Something isn't working label Mar 17, 2024
@abidlabs
Copy link
Member

Thanks @skye0402 that's super weird but I'll look into it. Can you share a quick code snippet sharing how you're supplying the images to the chatbot so that I can repro the same on my end?

@abidlabs abidlabs added enhancement New feature or request cloud Issues that only happen when deploying Gradio on cloud services and removed enhancement New feature or request labels Mar 18, 2024
@abidlabs abidlabs self-assigned this Mar 18, 2024
@abidlabs abidlabs added the needs repro Awaiting full reproduction label Mar 18, 2024
@abidlabs
Copy link
Member

I'm having a bit of a hard time reproducing this. Here's the code I tried:

import gradio as gr

with gr.Blocks() as demo:
    gr.Chatbot([
        ("abc", ("panda.jpg", )),
    ])


demo.launch(root_path="/8044")

Running behind a proxy here just fine: http://35.85.61.147/8044/

Let me know if you can share any more details that could help us repro!

@liangjs
Copy link

liangjs commented Mar 19, 2024

I ran into the same issue. The host name is somehow truncated.

Running behind a proxy here just fine: http://35.85.61.147/8044/

Let me know if you can share any more details that could help us repro!

Can you try to run the service behind a reverse proxy with a host name?

@skye0402
Copy link
Author

@abidlabs

Just a code snippet - if this doesn't help I need to build a separate simple setup to show:

def user(state, user_message, imagebox, image_process_mode, history):
    """ Handle user interaction in the chat window """
    state["skip_llm"] = False
    state["imageBase64"] = []
    if len(user_message) <= 0 and imagebox is None:
        state["skip_llm"] = True
        return "", history, None
    if imagebox is not None:
        user_message = user_message[:1200]  # Hard cut-off for images
        state["imageBase64"] = get_image(image=imagebox, image_process_mode=image_process_mode)
        history = history + [((imagebox,), None)]
    rv =  "", history + [[user_message, None]], None
    return rv

history + [[user_message, None]] is passed back to the Chatbot. Let me know if that helps.

@rwb-truelime
Copy link

rwb-truelime commented Mar 19, 2024

Running into this issue on Azure cloud (container instances). The output images get served with a corrupted url on the Azure domain of container instances (...azurecontainer.io --> ...azurec).

Gradio container is running on localhost serving to a Caddy reverse-proxy, learn more about this config here.

You can check out the instance here:

https://tl-clipdemo.westeurope.azurecontainer.io/

Try searching for "A tiger walking", we are testing CPU based searching on CLIP embeddings. Results will take about 25 seconds. The output urls are truncated on the domain name (hostname), for example:

https://tl-clipdemo.westeurope.azurec/file=/root/cache/9aa0715d22dad0cdf6fd23123db59262368fb0e6/image.png

Should be:

https://tl-clipdemo.westeurope.azurecontainer.io/file=/root/cache/9aa0715d22dad0cdf6fd23123db59262368fb0e6/image.png

Thanks for looking into this!

@rwb-truelime
Copy link

I'm having a bit of a hard time reproducing this. Here's the code I tried:

import gradio as gr

with gr.Blocks() as demo:
    gr.Chatbot([
        ("abc", ("panda.jpg", )),
    ])


demo.launch(root_path="/8044")

Running behind a proxy here just fine: http://35.85.61.147/8044/

Let me know if you can share any more details that could help us repro!

Please try this with a hostname, not an IP address.

@abidlabs
Copy link
Member

abidlabs commented Mar 21, 2024

Hi @liangjs @skye0402 @rwb-truelime I just added some logging to Gradio -- if you install this version of Gradio, it should print some stuff to your terminal. Would you be able to please install and let me know what is printed to your terminal?

pip install https://gradio-builds.s3.amazonaws.com/ba3ac976918be4aec67b02baca37459e64537c33/gradio-4.22.0-py3-none-any.whl

@liangjs
Copy link

liangjs commented Mar 22, 2024

pip install https://gradio-builds.s3.amazonaws.com/ba3ac976918be4aec67b02baca37459e64537c33/gradio-4.22.0-py3-none-any.whl

I don't know why it prints nothing in my log, but with this patch the image url works fine for me.

@abidlabs
Copy link
Member

Ok good to hear, we'll get the PR in soon!

@rwb-truelime
Copy link

Thanks! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cloud Issues that only happen when deploying Gradio on cloud services needs repro Awaiting full reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants