fixed conflicts

This commit is contained in:
Abubakar Abid 2021-10-12 00:37:10 -05:00
commit 1981933598
7 changed files with 34 additions and 19 deletions

View File

@ -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

View File

@ -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",

View File

@ -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):

View File

@ -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"
]
}

View File

@ -8,4 +8,4 @@
window.config = {{ config|tojson }};
} catch (e) {
window.config = {};
}</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.dcd72078.css" rel="stylesheet"></head><body style="height:100%"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>
}</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.c7f424fd.css" rel="stylesheet"></head><body style="height:100%"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>

View File

@ -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)

View File

@ -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