0

I am trying a simple example of Gradio on a Sagemaker Studio Lab notebook. But the output does not appear. According to the documentation when running on a notebook it should appear right in the notebook. This is indeed what happens when I run the example in Google CoLab. Is an additional setting needed for Sagemaker Studio Lab. The example is

    import gradio as gr
    def greet(name):
        return "Hello " + name + "!"
    demo = gr.Interface(fn=greet, inputs= "text", outputs = "text")
    demo.launch()

Nothing appears.

Executed demo.launch(), but nothing appeared.

1 Answers1

0

While I am not sure of what example you are using have you tried:

Use inline=False and server_port=6006.

gr.Interface(
    fn=infer,
    title="Monocular Depth Estimation",
    description = "Keras Implementation of Unet architecture with Densenet201 backbone for estimating the depth of image ",
    inputs=[gr.inputs.Image(label="image", type="numpy", shape=(640, 480))],
    outputs="image",
    article = "Author: <a href=\"https://huggingface.co/vumichien\">Vu Minh Chien</a>. Based on the Keras example from <a href=\"https://keras.io/examples/vision/depth_estimation/\">Victor Basu</a>. Repo: https://github.com/machinelearnear/use-gradio-streamlit-sagemaker-studiolab",
    examples=examples).launch(inline=False, server_port=6006, debug=True, cache_examples=True)

https://github.com/machinelearnear/use-gradio-streamlit-sagemaker-studiolab

Marc Karp
  • 949
  • 4
  • 6
  • Thanks for the response Marc. Actually I'm using a simpler example, attempting to get the default behavior of displaying inline. import gradio as gr def greet(name): return "Hello " + name + "!" demo = gr.Interface(fn=greet, inputs="text", outputs="text") demo.launch() – user2702019 Aug 03 '23 at 21:16
  • I now see that the !pip install gradio never terminates. – user2702019 Aug 07 '23 at 17:29
  • I find that I am able to install gradio with conda, but it still does not work properly. I don't see the input and output squares. It does ask me to update conda with – user2702019 Aug 07 '23 at 18:36
  • It asks me to run **bold** 'conda update -n base conda' but I get the error message **bold** 'The current user does not have write permissions to the target environment location: /opt/conda' – user2702019 Aug 07 '23 at 18:45