Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import torch
|
| 3 |
from diffusers import CosmosTextToImagePipeline
|
| 4 |
import random
|
|
@@ -10,6 +17,7 @@ model_id = "diffusers-internal-dev/ct2i-14B"
|
|
| 10 |
pipe = CosmosTextToImagePipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
|
| 11 |
pipe.to("cuda")
|
| 12 |
|
|
|
|
| 13 |
def generate_image(prompt, negative_prompt, seed, randomize_seed):
|
| 14 |
"""
|
| 15 |
Generates an image based on the provided prompt and negative prompt.
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
os.chdir('diffusers_repo')
|
| 5 |
+
subprocess.check_call(['pip', 'install', '-e', '.'])
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
+
import spaces
|
| 9 |
import torch
|
| 10 |
from diffusers import CosmosTextToImagePipeline
|
| 11 |
import random
|
|
|
|
| 17 |
pipe = CosmosTextToImagePipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
|
| 18 |
pipe.to("cuda")
|
| 19 |
|
| 20 |
+
@spaces.GPU
|
| 21 |
def generate_image(prompt, negative_prompt, seed, randomize_seed):
|
| 22 |
"""
|
| 23 |
Generates an image based on the provided prompt and negative prompt.
|