Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,19 @@ from src.flux.generate import generate, seed_everything
|
|
| 8 |
|
| 9 |
|
| 10 |
def process_image(api_key, seed, image, prompt):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
if not api_key:
|
| 12 |
raise gr.Error("❌ Please enter a valid OpenAI API key.")
|
| 13 |
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def process_image(api_key, seed, image, prompt):
|
| 11 |
+
|
| 12 |
+
import torch
|
| 13 |
+
|
| 14 |
+
# 检查是否有可用的 CUDA 设备
|
| 15 |
+
print("CUDA 是否可用:", torch.cuda.is_available())
|
| 16 |
+
|
| 17 |
+
# 输出当前 CUDA 版本(如果可用)
|
| 18 |
+
if torch.cuda.is_available():
|
| 19 |
+
print("CUDA 版本:", torch.version.cuda)
|
| 20 |
+
print("当前 GPU 名称:", torch.cuda.get_device_name(0)) # 输出第 0 号 GPU 的名称
|
| 21 |
+
print("GPU 设备数量:", torch.cuda.device_count())
|
| 22 |
+
else:
|
| 23 |
+
print("PyTorch 未启用 CUDA,当前使用 CPU 运行。")
|
| 24 |
if not api_key:
|
| 25 |
raise gr.Error("❌ Please enter a valid OpenAI API key.")
|
| 26 |
|