Arafath10 commited on
Commit
07fe890
1 Parent(s): d10947d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -0
main.py CHANGED
@@ -7,6 +7,7 @@ import pandas as pd
7
  from io import StringIO
8
  import os
9
  import uuid
 
10
 
11
  import googletrans
12
  from googletrans import Translator
@@ -51,6 +52,16 @@ def convert_image_to_base64(image_path):
51
  return img_base64_string
52
 
53
 
 
 
 
 
 
 
 
 
 
 
54
  @app.post("/get_image_for_text")
55
  async def get_image_for_text(email,query,file: UploadFile = File(...)):
56
  print(file.filename)
 
7
  from io import StringIO
8
  import os
9
  import uuid
10
+ from apscheduler.schedulers.background import BackgroundScheduler
11
 
12
  import googletrans
13
  from googletrans import Translator
 
52
  return img_base64_string
53
 
54
 
55
+ # Function to call the endpoint
56
+ def call_my_endpoint():
57
+ #response = requests.get("http://127.0.0.1:8000/my-endpoint")
58
+ print(f"Endpoint response: {response.json()}")
59
+
60
+ # Configure the scheduler
61
+ scheduler = BackgroundScheduler()
62
+ scheduler.add_job(call_my_endpoint, 'interval', seconds=15) # Call every 30 seconds
63
+ scheduler.start()
64
+
65
  @app.post("/get_image_for_text")
66
  async def get_image_for_text(email,query,file: UploadFile = File(...)):
67
  print(file.filename)