Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,10 +101,15 @@ index_html = """
|
|
| 101 |
throw new Error('画像生成に失敗しました');
|
| 102 |
}
|
| 103 |
const imageBlob = await response.blob();
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
} catch (error) {
|
| 109 |
alert(error.message);
|
| 110 |
} finally {
|
|
@@ -190,6 +195,4 @@ def generate_image():
|
|
| 190 |
return send_file(img_io, mimetype='image/png')
|
| 191 |
|
| 192 |
if __name__ == '__main__':
|
| 193 |
-
# Ensure the 'static' folder exists for saving images
|
| 194 |
-
os.makedirs('static', exist_ok=True)
|
| 195 |
app.run(host='0.0.0.0', port=7860)
|
|
|
|
| 101 |
throw new Error('画像生成に失敗しました');
|
| 102 |
}
|
| 103 |
const imageBlob = await response.blob();
|
| 104 |
+
|
| 105 |
+
// Convert Blob to Data URL
|
| 106 |
+
const reader = new FileReader();
|
| 107 |
+
reader.onloadend = function () {
|
| 108 |
+
const img = document.getElementById("generated-image");
|
| 109 |
+
img.src = reader.result; // dataURLを設定
|
| 110 |
+
img.style.display = 'block'; // 画像を表示
|
| 111 |
+
};
|
| 112 |
+
reader.readAsDataURL(imageBlob);
|
| 113 |
} catch (error) {
|
| 114 |
alert(error.message);
|
| 115 |
} finally {
|
|
|
|
| 195 |
return send_file(img_io, mimetype='image/png')
|
| 196 |
|
| 197 |
if __name__ == '__main__':
|
|
|
|
|
|
|
| 198 |
app.run(host='0.0.0.0', port=7860)
|