Spaces:
Running
Running
Update sd.py
Browse files
sd.py
CHANGED
|
@@ -18,17 +18,19 @@ def load_config():
|
|
| 18 |
with open('config.yaml', 'r') as f:
|
| 19 |
return yaml.safe_load(f)
|
| 20 |
|
| 21 |
-
def upload_to_imgbb(
|
| 22 |
"""
|
| 23 |
-
Uploads image
|
| 24 |
-
|
| 25 |
Args:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
Returns:
|
| 29 |
str: URL of the uploaded image on ImgBB.
|
| 30 |
"""
|
| 31 |
try:
|
|
|
|
|
|
|
|
|
|
| 32 |
response = requests.post(
|
| 33 |
"https://api.imgbb.com/1/upload",
|
| 34 |
params={
|
|
|
|
| 18 |
with open('config.yaml', 'r') as f:
|
| 19 |
return yaml.safe_load(f)
|
| 20 |
|
| 21 |
+
def upload_to_imgbb(image_path, file_name):
|
| 22 |
"""
|
| 23 |
+
Uploads image file to ImgBB and returns the URL.
|
|
|
|
| 24 |
Args:
|
| 25 |
+
image_path (str): Path to the image file.
|
| 26 |
+
file_name (str): Name of the image file.
|
| 27 |
Returns:
|
| 28 |
str: URL of the uploaded image on ImgBB.
|
| 29 |
"""
|
| 30 |
try:
|
| 31 |
+
with open(image_path, 'rb') as f:
|
| 32 |
+
image_data = f.read()
|
| 33 |
+
|
| 34 |
response = requests.post(
|
| 35 |
"https://api.imgbb.com/1/upload",
|
| 36 |
params={
|