akclick1401 commited on
Commit
ed5a1dd
·
verified ·
1 Parent(s): 142cd0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 # Nếu dùng mô hình riêng, thêm token từ Hugging Face
11
  )
12
- #pipe = pipe.to("cuda") # Chuyển sang GPU (nếu Space 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,4 +36,4 @@ interface = gr.Interface(
36
  )
37
 
38
  # Khởi chạy giao diện
39
- interface.launch(server_name="0.0.0.0", server_port=7860)
 
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 server_port