Dash-inc commited on
Commit
19f8479
·
verified ·
1 Parent(s): 3555d2b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -33,7 +33,7 @@ app.add_middleware(
33
  # Globals
34
  executor = ThreadPoolExecutor(max_workers=10)
35
  llm = None
36
- upscale_model = None
37
  client = MongoClient(f"mongodb+srv://hammad:{quote_plus('momimaad@123')}@cluster0.2a9yu.mongodb.net/")
38
  db = client["Flux"]
39
  collection = db["chat_histories"]
@@ -58,7 +58,7 @@ async def startup():
58
  max_tokens=1024,
59
  api_key="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",
60
  )
61
- upscale_model = AuraSR.from_pretrained("fal/AuraSR-v2")
62
 
63
  @app.on_event("shutdown")
64
  def shutdown():
@@ -196,7 +196,7 @@ async def upscale_image(image_url: str, background_tasks: BackgroundTasks):
196
  def process_image():
197
  response = requests.get(image_url)
198
  img = Image.open(BytesIO(response.content))
199
- upscaled_image = upscale_model.upscale_4x_overlapped(img)
200
  filename = f"upscaled_{uuid.uuid4()}.png"
201
  filepath = save_image_locally(upscaled_image, filename)
202
  return filepath
 
33
  # Globals
34
  executor = ThreadPoolExecutor(max_workers=10)
35
  llm = None
36
+ aura_sr = None
37
  client = MongoClient(f"mongodb+srv://hammad:{quote_plus('momimaad@123')}@cluster0.2a9yu.mongodb.net/")
38
  db = client["Flux"]
39
  collection = db["chat_histories"]
 
58
  max_tokens=1024,
59
  api_key="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",
60
  )
61
+ aura_sr = AuraSR.from_pretrained("fal/AuraSR-v2")
62
 
63
  @app.on_event("shutdown")
64
  def shutdown():
 
196
  def process_image():
197
  response = requests.get(image_url)
198
  img = Image.open(BytesIO(response.content))
199
+ upscaled_image = aura_sr.upscale_4x_overlapped(img)
200
  filename = f"upscaled_{uuid.uuid4()}.png"
201
  filepath = save_image_locally(upscaled_image, filename)
202
  return filepath