Update main.py
Browse files
main.py
CHANGED
@@ -123,18 +123,7 @@ def generate_image_with_gemini(prompt):
|
|
123 |
return part.inline_data.data
|
124 |
|
125 |
|
126 |
-
|
127 |
-
# 使用 Hugging Face 生成圖片
|
128 |
-
def generate_image_hf(prompt):
|
129 |
-
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2"
|
130 |
-
headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"}
|
131 |
-
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
132 |
-
if response.status_code == 200:
|
133 |
-
return response.content # 圖片binary資料
|
134 |
-
else:
|
135 |
-
print("圖片生成失敗:", response.text)
|
136 |
-
return None
|
137 |
-
''''
|
138 |
#==========================
|
139 |
# 使用者上傳圖片
|
140 |
#==========================
|
|
|
123 |
return part.inline_data.data
|
124 |
|
125 |
|
126 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
#==========================
|
128 |
# 使用者上傳圖片
|
129 |
#==========================
|