zliang commited on
Commit
6ca10bc
·
verified ·
1 Parent(s): 083f8b7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -5
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/images"
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
- file_path = os.path.join(image_directory, filename)
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