Code Monkey home page Code Monkey logo

Comments (10)

abidlabs avatar abidlabs commented on July 30, 2024

Hi @ploncker this is the intended behavior. When you do gr.load(), Gradio reconstructs the demo for you locally using the UI components, styling, and version of the gradio library that you have installed locally. However, the function calls are made to the remote Space. So if you are gr.load-ing a Space that has custom components, you'll need to install them locally as well.

from gradio.

ploncker avatar ploncker commented on July 30, 2024

Hi @abidlabs thanks for replying. I'm not hosting the demo locally. I'm trying to gr.load() a private space from a public one. Are you suggesting in this instance can I think of the public space as being equivalent to a local host?
If I import the gradio_pdf into my public space

'''
import os
import gradio as gr
from gradio_pdf import PDF
key = os.environ['MY_TOKEN']
demo = gr.load("ploncker/emma", hf_token=key, src="spaces")
demo.launch()
'''
then I end up with the following error when uploading a pdf file:

gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception: [Errno 2] No such file or directory: '/tmp/gradio/b9c4e005bcfc18c805f30186061b14d3b0de3ed1/splunk-guide-to-operational-intelligence.pdf'

My guess is this happens because the the public space is using the public PDF component and uploading to somewhere in the public instance, the private app is expecting a file but never sees it, so throws the error. If thats correct how does one pass the file object to the private space with a custom component?

from gradio.

abidlabs avatar abidlabs commented on July 30, 2024

Hi @abidlabs thanks for replying. I'm not hosting the demo locally. I'm trying to gr.load() a private space from a public one. Are you suggesting in this instance can I think of the public space as being equivalent to a local host?

Correct

from gradio.

abidlabs avatar abidlabs commented on July 30, 2024

Regarding the error that you're seeing, can you confirm that both Spaces are using the latest versions of gradio?

from gradio.

ploncker avatar ploncker commented on July 30, 2024

Public space logs: RUN pip install --no-cache-dir gradio[oauth]==4.37.2 "uvicorn>=0.14.0" spaces
Private space logs: RUN pip install --no-cache-dir gradio[oauth]==4.37.2 "uvicorn>=0.14.0" spaces

from gradio.

abidlabs avatar abidlabs commented on July 30, 2024

Hmm interesting, let me reopen and see if we can reproduce this on our end

from gradio.

ploncker avatar ploncker commented on July 30, 2024

Ok. Thanks for having a look.

Also just for clarity when the error says:
gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception: [Errno 2] No such file or directory
Is the private space upstream or is the public space upstream?

I'm a bit confused in which takes precedence. Is it:
Private(equivalent to remote)-> Public(equivalent to local), ie Private upstream from Public, or is it the other way around?

from gradio.

abidlabs avatar abidlabs commented on July 30, 2024

The private / remote app is the one raising the exception here

from gradio.

zhangweikun69 avatar zhangweikun69 commented on July 30, 2024

I have kind of same issue here. I used gr.load() to load one of my private space into my public space, the whole UI is good, instead of the images and the svgs generated by the private space are not accessible inside the public space.
I can see from the browser internet that the public space was trying to access images from one tmp file of the private one, which I think it had been deleted.
I guess this is what happens:

  1. public-space:copied_functionA inside the gr.load() blocks has been called
  2. private-space:functionA runs and generate imageA remotely
  3. imageA has been preprocessed by gradio so it can be rendered in the browser, imageA becomes tmpImageA
  4. tmpImageA deleted since it is a tmp file?
  5. public-space try to fetch that tmp file which has been already deleted?
    Are those steps correct? I feel like something wrong, and how to fix this?

Code in private-space For example:
with gr.Row(variant="panel"):
regenerate_btn.click(fn=generateImageA, inputs=[], outputs=[imageA])

from gradio.

zhangweikun69 avatar zhangweikun69 commented on July 30, 2024

I have kind of same issue here. I used gr.load() to load one of my private space into my public space, the whole UI is good, instead of the images and the svgs generated by the private space are not accessible inside the public space. I can see from the browser internet that the public space was trying to access images from one tmp file of the private one, which I think it had been deleted. I guess this is what happens:

  1. public-space:copied_functionA inside the gr.load() blocks has been called
  2. private-space:functionA runs and generate imageA remotely
  3. imageA has been preprocessed by gradio so it can be rendered in the browser, imageA becomes tmpImageA
  4. tmpImageA deleted since it is a tmp file?
  5. public-space try to fetch that tmp file which has been already deleted?
    Are those steps correct? I feel like something wrong, and how to fix this?

Code in private-space For example: with gr.Row(variant="panel"): regenerate_btn.click(fn=generateImageA, inputs=[], outputs=[imageA])

I'm sorry this is not what exactly happened.
It's just the tmp file path is 404 not found, I still have no clue about it

from gradio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.