Spaces:
Runtime error
Runtime error
Add SD v1.4
Browse files
app.py
CHANGED
|
@@ -1,6 +1,22 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
generator = pipeline('text-generation', model='gpt2')
|
| 4 |
set_seed(42)
|
| 5 |
|
| 6 |
-
generator("Hello world, I'm vizard,", max_length=50, num_return_sequences=3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
import os
|
| 3 |
+
import requests
|
| 4 |
+
import gradio as gr
|
| 5 |
+
from datasets import load_dataset
|
| 6 |
+
from PIL import Image
|
| 7 |
+
import torch
|
| 8 |
+
from torch import autocast
|
| 9 |
|
| 10 |
+
from transformers import pipeline, set_seed
|
| 11 |
+
from diffusers import StableDiffusionPipeline
|
| 12 |
+
|
| 13 |
+
# GPT2
|
| 14 |
generator = pipeline('text-generation', model='gpt2')
|
| 15 |
set_seed(42)
|
| 16 |
|
| 17 |
+
generator("Hello world, I'm vizard,", max_length=50, num_return_sequences=3)
|
| 18 |
+
|
| 19 |
+
# SD v1.4
|
| 20 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True, revision="fp16", torch_dtype=torch.float16)
|
| 21 |
+
pipe = pipe.to(device)
|
| 22 |
+
torch.backends.cudnn.benchmark = True
|