Skip to content
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

chore: update versions #8458

Merged
merged 1 commit into from
Jun 6, 2024
Merged

chore: update versions #8458

merged 1 commit into from
Jun 6, 2024

Conversation

pngwn
Copy link
Member

@pngwn pngwn commented Jun 5, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@gradio/client@1.0.0

Highlights

Clients 1.0 Launch! (#8468 7cc0a0c)

We're excited to unveil the first major release of the Gradio clients.
We've made it even easier to turn any Gradio application into a production endpoint thanks to the clients' ergonomic, transparent, and portable design.

Ergonomic API 💆

Stream From a Gradio app in 5 lines

Use the submit method to get a job you can iterate over:

from gradio_client import Client

client = Client("gradio/llm_stream")

for result in client.submit("What's the best UI framework in Python?"):
    print(result)
import { Client } from "@gradio/client";

const client = await Client.connect("gradio/llm_stream")
const job = client.submit("/predict", {"text": "What's the best UI framework in Python?"})

for await (const msg of job) console.log(msg.data)

Use the same keyword arguments as the app

from gradio_client import Client

client = Client("http://127.0.0.1:7860/")
result = client.predict(
		message="Hello!!",
		system_prompt="You are helpful AI.",
		tokens=10,
		api_name="/chat"
)
print(result)
import { Client } from "@gradio/client";

const client = await Client.connect("http://127.0.0.1:7860/");
const result = await client.predict("/chat", { 		
		message: "Hello!!", 		
		system_prompt: "Hello!!", 		
		tokens: 10, 
});

console.log(result.data);

Better Error Messages

If something goes wrong in the upstream app, the client will raise the same exception as the app provided that show_error=True in the original app's launch() function, or it's a gr.Error exception.

Transparent Design 🪟

Anything you can do in the UI, you can do with the client:

  • 🔒 Authentication
  • 🛑 Job Cancelling
  • ℹ️ Access Queue Position and API
  • 📕 View the API information

Here's an example showing how to display the queue position of a pending job:

from gradio_client import Client

client = Client("gradio/diffusion_model")

job = client.submit("A cute cat")
while not job.done():
    status = job.status()
    print(f"Current in position {status.rank} out of {status.queue_size}")

Portable Design ⛺️

The client can run from pretty much any python and javascript environment (node, deno, the browser, Service Workers).

Here's an example using the client from a Flask server using gevent:

from gevent import monkey
monkey.patch_all()

from gradio_client import Client
from flask import Flask, send_file
import time

app = Flask(__name__)

imageclient = Client("gradio/diffusion_model")

@app.route("/gen")
def gen():
      result = imageclient.predict(
                "A cute cat",
                api_name="/predict"
              )
      return send_file(result)

if __name__ == "__main__":
      app.run(host="0.0.0.0", port=5000)

1.0 Migration Guide and Breaking Changes

Python

  • The serialize argument of the Client class was removed. Has no effect.
  • The upload_files argument of the Client was removed.
  • All filepaths must be wrapped in the handle_file method. Example:
from gradio_client import Client, handle_file

client = Client("gradio/image_captioner")
client.predict(handle_file("cute_cat.jpg"))
  • The output_dir argument was removed. It is not specified in the download_files argument.

Javascript
The client has been redesigned entirely. It was refactored from a function into a class. An instance can now be constructed by awaiting the connect method.

const app = await Client.connect("gradio/whisper")

The app variable has the same methods as the python class (submit, predict, view_api, duplicate).

Additional Changes

  • #8243 - Set orig_name in python client file uploads.

  • #8264 - Make exceptions in the Client more specific.

  • #8247 - Fix api recorder.

  • #8276 - Fix bug where client could not connect to apps that had self signed certificates.

  • #8245 - Cancel server progress from the python client.

  • #8200 - Support custom components in gr.load

  • #8182 - Convert sse calls in client from async to sync.

  • #7732 - Adds support for kwargs and default arguments in the python client, and improves how parameter information is displayed in the "view API" page.

  • #7888 - Cache view_api info in server and python client.

  • #7575 - Files should now be supplied as file(...) in the Client, and some fixes to gr.load() as well.

  • #8401 - Add CDN installation to JS docs.

  • #8299 - Allow JS Client to work with authenticated spaces 🍪.

  • #8408 - Connect heartbeat if state created in render. Also fix config cleanup bug Connect heartbeat if state created in render. Also fix config cleanup bug #8407.

  • #8258 - Improve URL handling in JS Client.

  • #8322 - ensure the client correctly handles all binary data.

  • #8296 - always create a jwt when connecting to a space if a hf_token is present.

  • #8285 - use the correct query param to pass the jwt to the heartbeat event.

  • #8272 - ensure client works for private spaces.

  • #8197 - Add support for passing keyword args to data in JS client.

  • #8252 - Client node fix.

  • #8209 - Rename eventSource_Factory and fetch_implementation.

  • #8109 - Implement JS Client tests.

  • #8211 - remove redundant event source logic.

  • #8179 - rework upload to be a class method + pass client into each component.

  • #8181 - Ensure connectivity to private HF spaces with SSE protocol.

  • #8169 - Only connect to heartbeat if needed.

  • #8118 - Add eventsource polyfill for Node.js and browser environments.

  • #7646 - Refactor JS Client.

  • #7974 - Fix heartbeat in the js client to be Lite compatible.

  • #7926 - Fixes streaming event race condition.

    Thanks @freddyaboulton!

Features

Fixes

gradio_client@1.0.0

Highlights

Clients 1.0 Launch! (#8468 7cc0a0c)

We're excited to unveil the first major release of the Gradio clients.
We've made it even easier to turn any Gradio application into a production endpoint thanks to the clients' ergonomic, transparent, and portable design.

Ergonomic API 💆

Stream From a Gradio app in 5 lines

Use the submit method to get a job you can iterate over:

from gradio_client import Client

client = Client("gradio/llm_stream")

for result in client.submit("What's the best UI framework in Python?"):
    print(result)
import { Client } from "@gradio/client";

const client = await Client.connect("gradio/llm_stream")
const job = client.submit("/predict", {"text": "What's the best UI framework in Python?"})

for await (const msg of job) console.log(msg.data)

Use the same keyword arguments as the app

from gradio_client import Client

client = Client("http://127.0.0.1:7860/")
result = client.predict(
		message="Hello!!",
		system_prompt="You are helpful AI.",
		tokens=10,
		api_name="/chat"
)
print(result)
import { Client } from "@gradio/client";

const client = await Client.connect("http://127.0.0.1:7860/");
const result = await client.predict("/chat", { 		
		message: "Hello!!", 		
		system_prompt: "Hello!!", 		
		tokens: 10, 
});

console.log(result.data);

Better Error Messages

If something goes wrong in the upstream app, the client will raise the same exception as the app provided that show_error=True in the original app's launch() function, or it's a gr.Error exception.

Transparent Design 🪟

Anything you can do in the UI, you can do with the client:

  • 🔒 Authentication
  • 🛑 Job Cancelling
  • ℹ️ Access Queue Position and API
  • 📕 View the API information

Here's an example showing how to display the queue position of a pending job:

from gradio_client import Client

client = Client("gradio/diffusion_model")

job = client.submit("A cute cat")
while not job.done():
    status = job.status()
    print(f"Current in position {status.rank} out of {status.queue_size}")

Portable Design ⛺️

The client can run from pretty much any python and javascript environment (node, deno, the browser, Service Workers).

Here's an example using the client from a Flask server using gevent:

from gevent import monkey
monkey.patch_all()

from gradio_client import Client
from flask import Flask, send_file
import time

app = Flask(__name__)

imageclient = Client("gradio/diffusion_model")

@app.route("/gen")
def gen():
      result = imageclient.predict(
                "A cute cat",
                api_name="/predict"
              )
      return send_file(result)

if __name__ == "__main__":
      app.run(host="0.0.0.0", port=5000)

1.0 Migration Guide and Breaking Changes

Python

  • The serialize argument of the Client class was removed. Has no effect.
  • The upload_files argument of the Client was removed.
  • All filepaths must be wrapped in the handle_file method. Example:
from gradio_client import Client, handle_file

client = Client("gradio/image_captioner")
client.predict(handle_file("cute_cat.jpg"))
  • The output_dir argument was removed. It is not specified in the download_files argument.

Javascript
The client has been redesigned entirely. It was refactored from a function into a class. An instance can now be constructed by awaiting the connect method.

const app = await Client.connect("gradio/whisper")

The app variable has the same methods as the python class (submit, predict, view_api, duplicate).

Additional Changes

  • #8243 - Set orig_name in python client file uploads.

  • #8264 - Make exceptions in the Client more specific.

  • #8247 - Fix api recorder.

  • #8276 - Fix bug where client could not connect to apps that had self signed certificates.

  • #8245 - Cancel server progress from the python client.

  • #8200 - Support custom components in gr.load

  • #8182 - Convert sse calls in client from async to sync.

  • #7732 - Adds support for kwargs and default arguments in the python client, and improves how parameter information is displayed in the "view API" page.

  • #7888 - Cache view_api info in server and python client.

  • #7575 - Files should now be supplied as file(...) in the Client, and some fixes to gr.load() as well.

  • #8401 - Add CDN installation to JS docs.

  • #8299 - Allow JS Client to work with authenticated spaces 🍪.

  • #8408 - Connect heartbeat if state created in render. Also fix config cleanup bug Connect heartbeat if state created in render. Also fix config cleanup bug #8407.

  • #8258 - Improve URL handling in JS Client.

  • #8322 - ensure the client correctly handles all binary data.

  • #8296 - always create a jwt when connecting to a space if a hf_token is present.

  • #8285 - use the correct query param to pass the jwt to the heartbeat event.

  • #8272 - ensure client works for private spaces.

  • #8197 - Add support for passing keyword args to data in JS client.

  • #8252 - Client node fix.

  • #8209 - Rename eventSource_Factory and fetch_implementation.

  • #8109 - Implement JS Client tests.

  • #8211 - remove redundant event source logic.

  • #8179 - rework upload to be a class method + pass client into each component.

  • #8181 - Ensure connectivity to private HF spaces with SSE protocol.

  • #8169 - Only connect to heartbeat if needed.

  • #8118 - Add eventsource polyfill for Node.js and browser environments.

  • #7646 - Refactor JS Client.

  • #7974 - Fix heartbeat in the js client to be Lite compatible.

  • #7926 - Fixes streaming event race condition.

    Thanks @freddyaboulton!

Features

gradio@4.34.0

Features

Fixes

@gradio/audio@0.11.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/button@0.2.41

@gradio/button@0.2.41

Dependency updates

  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/chatbot@0.10.9

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/audio@0.11.8
  • @gradio/image@0.11.8
  • @gradio/video@0.8.8
  • @gradio/markdown@0.7.6

@gradio/code@0.6.9

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/upload@0.11.0

@gradio/dataframe@0.8.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/button@0.2.41
  • @gradio/markdown@0.7.6

@gradio/dataset@0.1.41

Dependency updates

  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/downloadbutton@0.1.18

Dependency updates

  • @gradio/client@1.0.0
  • @gradio/button@0.2.41

@gradio/file@0.8.0

Features

Fixes

  • #8451 9d2d605 - Change client submit API to be an AsyncIterable and support more platforms. Thanks @pngwn!

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/gallery@0.10.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/file@0.8.0
  • @gradio/upload@0.11.0
  • @gradio/image@0.11.8

@gradio/image@0.11.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/imageeditor@0.7.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/image@0.11.8

@gradio/lite@4.34.0

Dependency updates

  • gradio@4.34.0

@gradio/model3d@0.10.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/multimodaltextbox@0.4.9

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/image@0.11.8

@gradio/preview@0.9.1

Fixes

@gradio/simpleimage@0.5.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/tootils@0.5.0

Features

Dependency updates

  • @gradio/statustracker@0.6.0

@gradio/upload@0.11.0

Features

Dependency updates

  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/uploadbutton@0.6.9

Dependency updates

  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/button@0.2.41

@gradio/video@0.8.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0
  • @gradio/image@0.11.8

website@0.31.3

Features

Dependency updates

  • @gradio/code@0.6.9

@gradio/annotatedimage@0.6.8

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/upload@0.11.0

@gradio/app@1.36.0

Features

Fixes

Dependency updates

  • @gradio/code@0.6.9
  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/file@0.8.0
  • @gradio/upload@0.11.0
  • @gradio/annotatedimage@0.6.8
  • @gradio/audio@0.11.8
  • @gradio/button@0.2.41
  • @gradio/chatbot@0.10.9
  • @gradio/dataframe@0.8.8
  • @gradio/dataset@0.1.41
  • @gradio/downloadbutton@0.1.18
  • @gradio/fileexplorer@0.4.9
  • @gradio/gallery@0.10.8
  • @gradio/image@0.11.8
  • @gradio/imageeditor@0.7.8
  • @gradio/model3d@0.10.8
  • @gradio/multimodaltextbox@0.4.9
  • @gradio/simpleimage@0.5.8
  • @gradio/uploadbutton@0.6.9
  • @gradio/video@0.8.8
  • @gradio/accordion@0.3.16
  • @gradio/checkbox@0.3.6
  • @gradio/checkboxgroup@0.5.6
  • @gradio/colorpicker@0.3.6
  • @gradio/column@0.1.2
  • @gradio/dropdown@0.7.6
  • @gradio/fallback@0.3.6
  • @gradio/form@0.1.18
  • @gradio/group@0.1.1
  • @gradio/highlightedtext@0.7.0
  • @gradio/html@0.2.6
  • @gradio/json@0.2.6
  • @gradio/label@0.3.6
  • @gradio/markdown@0.7.6
  • @gradio/number@0.4.6
  • @gradio/paramviewer@0.4.15
  • @gradio/plot@0.4.6
  • @gradio/radio@0.5.6
  • @gradio/row@0.1.3
  • @gradio/simpledropdown@0.2.6
  • @gradio/simpletextbox@0.2.6
  • @gradio/slider@0.4.6
  • @gradio/tabitem@0.2.10
  • @gradio/tabs@0.2.9
  • @gradio/textbox@0.6.5

@gradio/fileexplorer@0.4.9

Dependency updates

  • @gradio/statustracker@0.6.0
  • @gradio/client@1.0.0
  • @gradio/file@0.8.0
  • @gradio/upload@0.11.0
  • @gradio/checkbox@0.3.6

@pngwn pngwn added no-visual-update Add this to a PR to skip chromatic deployment and tests flaky-tests This label runs flaky tests (those that use the HF API) on a PR windows-tests Run backend tests on Windows on this PR (by default, applied only to the changeset release PR) labels Jun 5, 2024
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jun 5, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook building...
🦄 Changes skipped! Workflow log

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/0fdfb9856e3fdd98e3e8a439b5b9f42b95e32d9d/gradio-4.33.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@0fdfb9856e3fdd98e3e8a439b5b9f42b95e32d9d#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-builds.s3.amazonaws.com/0fdfb9856e3fdd98e3e8a439b5b9f42b95e32d9d/gradio-client-1.0.0.tgz

@pngwn pngwn force-pushed the changeset-release/main branch 8 times, most recently from 486adf1 to 4bb9596 Compare June 6, 2024 11:59
@abidlabs abidlabs merged commit b301ce4 into main Jun 6, 2024
8 of 9 checks passed
@abidlabs abidlabs deleted the changeset-release/main branch June 6, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-tests This label runs flaky tests (those that use the HF API) on a PR no-visual-update Add this to a PR to skip chromatic deployment and tests windows-tests Run backend tests on Windows on this PR (by default, applied only to the changeset release PR)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants