Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ import torch
|
|
5 |
# Tải mô hình Stable Diffusion
|
6 |
model_id = "runwayml/stable-diffusion-v1-5"
|
7 |
pipe = StableDiffusionPipeline.from_pretrained(
|
8 |
-
model_id,
|
9 |
torch_dtype=torch.float16,
|
10 |
-
use_auth_token=False
|
11 |
)
|
12 |
-
|
13 |
|
14 |
# Hàm tạo hình ảnh
|
15 |
def generate_image(prompt, negative_prompt="", num_inference_steps=50, guidance_scale=7.5):
|
@@ -36,4 +36,4 @@ interface = gr.Interface(
|
|
36 |
)
|
37 |
|
38 |
# Khởi chạy giao diện
|
39 |
-
interface.launch(server_name
|
|
|
5 |
# Tải mô hình Stable Diffusion
|
6 |
model_id = "runwayml/stable-diffusion-v1-5"
|
7 |
pipe = StableDiffusionPipeline.from_pretrained(
|
8 |
+
model_id,
|
9 |
torch_dtype=torch.float16,
|
10 |
+
use_auth_token=False
|
11 |
)
|
12 |
+
pipe = pipe.to("cuda") # Giả sử bạn đã nâng cấp lên GPU
|
13 |
|
14 |
# Hàm tạo hình ảnh
|
15 |
def generate_image(prompt, negative_prompt="", num_inference_steps=50, guidance_scale=7.5):
|
|
|
36 |
)
|
37 |
|
38 |
# Khởi chạy giao diện
|
39 |
+
interface.launch() # Xóa server_name và server_port
|