Step #1 - Anyscale signup
Step #2 - Notebook for Deploying Diffusion models
Step #3 - Deploying Service Command
Step #4 - Service Deployment
Code Example -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Service specific config | |
base_url = "https://stable-diffusion-service.anyscaleuserdata.com" | |
token = "ABC" | |
# Requests config | |
path = "/imagine" | |
full_url = f"{base_url}{path}" | |
headers = {"Authorization": f"Bearer {token}"} | |
prompt = "BMW X1 with chrome box grill with a tall SUV Look" | |
image_size = 640 | |
resp = requests.get(full_url, headers=headers,params={"prompt": prompt, "img_size": image_size}) | |
image = resp.content | |
filename = "image.png" | |
with open(filename, "wb") as f: | |
f.write(image) | |
from IPython.display import Image | |
Image(filename=filename) |
Keep Exploring!!!
No comments:
Post a Comment