Spaces:
Sleeping
Sleeping
Rifat Azad commited on
Commit ·
4a152be
1
Parent(s): 481a481
fixed
Browse files
logger.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
-
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
@app.get("/")
|
| 7 |
async def read_root():
|
| 8 |
-
# Replace the URL with the desired image URL
|
| 9 |
image_url = "https://e0.pxfuel.com/wallpapers/464/238/desktop-wallpaper-python-graphic-design-graphical-user-interface-django-standing-background-python-coding.jpg"
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
import requests
|
| 3 |
+
from fastapi.responses import Response
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
@app.get("/")
|
| 8 |
async def read_root():
|
|
|
|
| 9 |
image_url = "https://e0.pxfuel.com/wallpapers/464/238/desktop-wallpaper-python-graphic-design-graphical-user-interface-django-standing-background-python-coding.jpg"
|
| 10 |
+
response = requests.get(image_url)
|
| 11 |
+
if response.status_code == 200:
|
| 12 |
+
return Response(content=response.content, media_type="image/jpeg")
|
| 13 |
+
else:
|
| 14 |
+
return {"message": "Failed to fetch image from the URL"}
|