diff --git a/frontend/README.md b/frontend/README.md index 0c83cde2ce..235cf13afa 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,3 +1,4 @@ +<<<<<<< HEAD # Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). @@ -68,3 +69,25 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/d ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +======= +# Gradio Frontend + +This directory contains a React App that renders the frontend of the gradio framework. + +## Development Setup + +To make changes to the gradio frontend, you will need to have the following installed +- npm / node +- python3 +- gradio + +Once node is installed, make sure to run `npm install` in this directory to install the node packages. + +Because this is only the frontend of the library, you must first launch a Gradio interface running on port 7860, which will be used as a backend. You can use any of the demo projects in the gradio/demo folder to serve this backend role, but make sure that the port is set to 7860. Then you launch the development frontend by running `npm run start`. Once this is run, the frontend development will launch on port 3000. It will connect with port 7860 to load the initial configuration and make API calls on submit. + +As a Create-React-App, any changes you make in the code will automatically reflect in the development frontend. + +## Committing Changes + +In production, the frontend is compiled and stored in the gradio/gradio/frontend directory. (This readme is in gradio/frontend, a different directory outside the python package). To compile, run `npm run build`. At the end of the process, you should see the message "Compiled successfully" - there may be an warning or error thrown about not being able to find bundle.css which you can ignore. To include the compiled js into your local python version of gradio, run `python3 setup.py install` and then launch a gradio interface. Your changes should be visible on port 7860. +>>>>>>> e2384b777c6b805bc6e295a8dc003b0a3d0f80c8 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d3f38fb34e..645f7f9ed8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -4172,9 +4172,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001208", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz", - "integrity": "sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==" + "version": "1.0.30001264", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001264.tgz", + "integrity": "sha512-Ftfqqfcs/ePiUmyaySsQ4PUsdcYyXG2rfoBVsk3iY1ahHaJEw65vfb7Suzqm+cEkwwPIv/XWkg27iCpRavH4zA==" }, "canvas": { "version": "2.8.0", diff --git a/gradio/external.py b/gradio/external.py index c25bf87ed1..9dc281eb05 100644 --- a/gradio/external.py +++ b/gradio/external.py @@ -2,7 +2,10 @@ import json import tempfile import requests from gradio import inputs, outputs +<<<<<<< HEAD import re +======= +>>>>>>> e2384b777c6b805bc6e295a8dc003b0a3d0f80c8 def get_huggingface_interface(model_name, api_key, alias): diff --git a/gradio/frontend/asset-manifest.json b/gradio/frontend/asset-manifest.json index 43a8eda7fe..52f2f77a31 100644 --- a/gradio/frontend/asset-manifest.json +++ b/gradio/frontend/asset-manifest.json @@ -1,6 +1,6 @@ { "files": { - "main.css": "/static/css/main.dcd72078.css", + "main.css": "/static/css/main.c7f424fd.css", "main.js": "/static/bundle.js", "index.html": "/index.html", "static/bundle.js.LICENSE.txt": "/static/bundle.js.LICENSE.txt", @@ -11,7 +11,7 @@ }, "entrypoints": [ "static/bundle.css", - "static/css/main.dcd72078.css", + "static/css/main.c7f424fd.css", "static/bundle.js" ] } \ No newline at end of file diff --git a/gradio/frontend/index.html b/gradio/frontend/index.html index 8ba5973edd..ed2bb344bc 100644 --- a/gradio/frontend/index.html +++ b/gradio/frontend/index.html @@ -8,4 +8,4 @@ window.config = {{ config|tojson }}; } catch (e) { window.config = {}; - }Gradio
\ No newline at end of file + }Gradio
diff --git a/gradio/interface.py b/gradio/interface.py index 279d6dc917..ce4c38fb82 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -503,7 +503,6 @@ class Interface: auth = [auth] self.auth = auth self.auth_message = auth_message - self.debug = debug or int(os.getenv('GRADIO_DEBUG', 0))==1 # Request key for encryption if self.encrypt: @@ -585,7 +584,7 @@ class Interface: show_tip(self) # Run server perpetually under certain circumstances - if self.debug: + if debug or int(os.getenv('GRADIO_DEBUG', 0))==1: while True: sys.stdout.flush() time.sleep(0.1) diff --git a/gradio/networking.py b/gradio/networking.py index 08cb687c6a..abd5c51bbc 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -26,7 +26,6 @@ from gradio import encryptor from gradio import queue from functools import wraps import io -import traceback INITIAL_PORT_VALUE = int(os.getenv( 'GRADIO_SERVER_PORT', "7860")) # The http server will try to open on port 7860. If not available, 7861, 7862, etc. @@ -178,16 +177,7 @@ def enable_sharing(path): @login_check def predict(): raw_input = request.json["data"] - # If in debug mode, capture any errors made and pipe to front end - if app.interface.debug: - try: - prediction, durations = app.interface.process(raw_input) - except BaseException as error: - traceback.print_exc() - return jsonify({"error": traceback.format_exc()}) - else: - prediction, durations = app.interface.process(raw_input) - # Get running average of prediction times + prediction, durations = app.interface.process(raw_input) avg_durations = [] for i, duration in enumerate(durations): app.interface.predict_durations[i][0] += duration