Update main.py
Browse files
main.py
CHANGED
|
@@ -8,12 +8,12 @@ app = FastAPI()
|
|
| 8 |
|
| 9 |
# Directory where images will be saved
|
| 10 |
# This directory must be publicly accessible through your web server
|
| 11 |
-
image_directory = "/images"
|
| 12 |
-
os.makedirs(image_directory, exist_ok=True)
|
| 13 |
|
| 14 |
# Base URL for the images
|
| 15 |
# Replace with your server's base URL
|
| 16 |
-
base_url = "https://zliang-argoapi.hf.space
|
| 17 |
|
| 18 |
@app.get("/plot_trajectory")
|
| 19 |
def plot_trajectory(lon_min: float, lon_max: float, lat_min: float, lat_max: float,
|
|
@@ -29,8 +29,7 @@ def plot_trajectory(lon_min: float, lon_max: float, lat_min: float, lat_max: flo
|
|
| 29 |
|
| 30 |
# Save the plot to a file with a unique name
|
| 31 |
filename = str(uuid.uuid4()) + ".png"
|
| 32 |
-
|
| 33 |
-
plt.savefig(file_path)
|
| 34 |
plt.close()
|
| 35 |
|
| 36 |
# Construct the URL for the saved image
|
|
|
|
| 8 |
|
| 9 |
# Directory where images will be saved
|
| 10 |
# This directory must be publicly accessible through your web server
|
| 11 |
+
#image_directory = "/images"
|
| 12 |
+
#os.makedirs(image_directory, exist_ok=True)
|
| 13 |
|
| 14 |
# Base URL for the images
|
| 15 |
# Replace with your server's base URL
|
| 16 |
+
base_url = "https://zliang-argoapi.hf.space"
|
| 17 |
|
| 18 |
@app.get("/plot_trajectory")
|
| 19 |
def plot_trajectory(lon_min: float, lon_max: float, lat_min: float, lat_max: float,
|
|
|
|
| 29 |
|
| 30 |
# Save the plot to a file with a unique name
|
| 31 |
filename = str(uuid.uuid4()) + ".png"
|
| 32 |
+
plt.savefig(filename)
|
|
|
|
| 33 |
plt.close()
|
| 34 |
|
| 35 |
# Construct the URL for the saved image
|