Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,20 @@ from transformers import pipeline
|
|
| 3 |
import torch
|
| 4 |
from diffusers import StableDiffusionPipeline
|
| 5 |
|
| 6 |
-
def get_completion(
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def generate(prompt,negative_prompt,steps,guidance,width,height):
|
| 11 |
params = {
|
|
|
|
| 3 |
import torch
|
| 4 |
from diffusers import StableDiffusionPipeline
|
| 5 |
|
| 6 |
+
def get_completion(inputs, parameters=None):
|
| 7 |
+
data = { "inputs": inputs }
|
| 8 |
+
if parameters is not None:
|
| 9 |
+
data.update({"parameters": parameters})
|
| 10 |
+
return pipeline(prompt, params)['sample'][0]
|
| 11 |
+
# response = requests.request("POST",
|
| 12 |
+
# ENDPOINT_URL,
|
| 13 |
+
# headers=headers,
|
| 14 |
+
# data=json.dumps(data))
|
| 15 |
+
# return json.loads(response.content.decode("utf-8"))
|
| 16 |
+
|
| 17 |
+
# def get_completion(prompt,params):
|
| 18 |
+
# return pipeline(prompt=prompt, height=params['height'], width=params['width'], num_inference_steps=params['num_inference_steps'], guidance_scale=params['guidance_scale'], negative_prompt=params['negative_prompt'])['sample'][0]
|
| 19 |
+
# # return pipeline(prompt, params)['sample'][0]
|
| 20 |
|
| 21 |
def generate(prompt,negative_prompt,steps,guidance,width,height):
|
| 22 |
params = {
|