Spaces:
Running on Zero
Running on Zero
Commit ·
383b616
1
Parent(s): 62c6ea1
[Admin maintenance] Support new ZeroGPU hardware (#1)
Browse files- [Admin maintenance] Support new ZeroGPU hardware (e44b24904bcc26d2aa907a4d891cabf1e9078d96)
app.py
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from PIL import Image
|
| 4 |
from diffusers import DiffusionPipeline
|
| 5 |
import os
|
| 6 |
-
import spaces
|
| 7 |
|
| 8 |
# Constants
|
| 9 |
#SAFETY_CHECKER = os.environ.get("SAFETY_CHECKER", "0") == "1"
|
|
@@ -31,8 +39,6 @@ def generate_image(prompt, num_inference_steps=50, guidance_scale=7):
|
|
| 31 |
|
| 32 |
return results.images[0]
|
| 33 |
|
| 34 |
-
import gradio as gr
|
| 35 |
-
|
| 36 |
# Gradio Interface
|
| 37 |
description = """
|
| 38 |
This demo utilizes the playgroundai/playground-v2.5-1024px-aesthetic by Playground, which is a text-to-image generative model capable of producing high-quality images.
|
|
@@ -64,4 +70,4 @@ with gr.Blocks() as demo:
|
|
| 64 |
outputs=img,
|
| 65 |
)
|
| 66 |
|
| 67 |
-
demo.queue().launch()
|
|
|
|
| 1 |
+
import huggingface_hub
|
| 2 |
+
if not hasattr(huggingface_hub, "HfFolder"):
|
| 3 |
+
class HfFolder:
|
| 4 |
+
@staticmethod
|
| 5 |
+
def get_token():
|
| 6 |
+
return huggingface_hub.get_token()
|
| 7 |
+
huggingface_hub.HfFolder = HfFolder
|
| 8 |
+
|
| 9 |
+
import spaces
|
| 10 |
import gradio as gr
|
| 11 |
import torch
|
| 12 |
from PIL import Image
|
| 13 |
from diffusers import DiffusionPipeline
|
| 14 |
import os
|
|
|
|
| 15 |
|
| 16 |
# Constants
|
| 17 |
#SAFETY_CHECKER = os.environ.get("SAFETY_CHECKER", "0") == "1"
|
|
|
|
| 39 |
|
| 40 |
return results.images[0]
|
| 41 |
|
|
|
|
|
|
|
| 42 |
# Gradio Interface
|
| 43 |
description = """
|
| 44 |
This demo utilizes the playgroundai/playground-v2.5-1024px-aesthetic by Playground, which is a text-to-image generative model capable of producing high-quality images.
|
|
|
|
| 70 |
outputs=img,
|
| 71 |
)
|
| 72 |
|
| 73 |
+
demo.queue().launch()
|