Skip to content

Add reload to docs #1365

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

Closed
1 task done
Zengyf-CVer opened this issue May 24, 2022 · 6 comments
Closed
1 task done

Add reload to docs #1365

Zengyf-CVer opened this issue May 24, 2022 · 6 comments
Assignees
Labels
docs/website Related to documentation or website
Milestone

Comments

@Zengyf-CVer
Copy link
Contributor

Describe the bug

@abidlabs
When executing gradio app.py, a bug was found. When the variable is demo, it runs normally and can be reloaded. But when the variable is demo1 or other, the program will report an error:

  • normal operation:
import gradio as gr


def greet(name):
    return "Hello " + name + "!!"

demo = gr.Interface(fn=greet, inputs="text", outputs="text")

if __name__ == "__main__":
    demo.launch()
  • bug:
import gradio as gr


def greet(name):
    return "Hello " + name + "!!"

demo1 = gr.Interface(fn=greet, inputs="text", outputs="text")

if __name__ == "__main__":
    demo1.launch()

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Error message:

ERROR:    Error loading ASGI app. Attribute "demo.app" not found in module "app".

Screenshot

No response

Logs

No response

System Info

gradio 3.0.5
ubuntu 20.04
chrome

Severity

annoying

@Zengyf-CVer Zengyf-CVer added the bug Something isn't working label May 24, 2022
@omerXfaruq
Copy link
Contributor

You need to run
gradio app.py demo1

Keeping issue open until this is added to docs

@omerXfaruq omerXfaruq changed the title gradio app.py -- reload bug Add reload to docs May 24, 2022
@omerXfaruq
Copy link
Contributor

We need to add reload mode commands to docs, see here

@omerXfaruq omerXfaruq added docs/website Related to documentation or website and removed bug Something isn't working labels May 25, 2022
@omerXfaruq
Copy link
Contributor

omerXfaruq commented May 27, 2022

Template:

$ gradio app.py, to run app.py in reload mode where any changes in the app.py file or Gradio library reloads the demo.
$ gradio app.py my_demo, to use variable names other than "demo"

gif

@Zengyf-CVer
Copy link
Contributor Author

Zengyf-CVer commented May 27, 2022

@farukozderim @aliabd
When I execute the code below via gradio app.py demo1, I get an error:

import gradio as gr


def greet(name):
    return "Hello " + name + "!!"

demo1 = gr.Interface(fn=greet, inputs="text", outputs="text")

if __name__ == "__main__":
    demo1.launch()

error:

Launching in *reload mode* on: http://127.0.0.1:7861 (Press CTRL+C to quit)

Error: Option '--reload-dir' requires an argument.

config:

gradio 3.0.6
ubuntu 20.04
chrome

@omerXfaruq
Copy link
Contributor

Thx for reporting @Zengyf-CVer, it is a known issue and should be fixed in the next version.
You could use the latest beta releases if you wish to
https://pypi.org/project/gradio/#history

@freddyaboulton freddyaboulton added this to the docs-2022-07 milestone Jul 1, 2022
@freddyaboulton
Copy link
Collaborator

Going to close as we already have a guide for reload mode here: https://gradio.app/developing_faster_with_reload_mode/

We're going to make this guide more visible in #1857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs/website Related to documentation or website
Projects
None yet
Development

No branches or pull requests

4 participants