randydev commited on
Commit
09b8e8a
·
verified ·
1 Parent(s): e08ac94

Update fluxai.py

Browse files
Files changed (1) hide show
  1. fluxai.py +4 -9
fluxai.py CHANGED
@@ -5,7 +5,6 @@ from fastapi import HTTPException
5
  import io
6
  import requests
7
  import os
8
- import httpx
9
  from dotenv import load_dotenv
10
  from pydantic import BaseModel
11
  from pymongo import MongoClient
@@ -146,14 +145,10 @@ async def fluxai_image(payload: FluxAI):
146
  with open(file_path, "wb") as f:
147
  f.write(enhanced_image_bytes.getvalue())
148
 
149
- async def upload_file(file_path: str):
150
- url = "https://randydev-ryuzaki-api.hf.space/api/v1/uploadfile/"
151
- async with httpx.AsyncClient() as client:
152
- with open(file_path, "rb") as f:
153
- response = await client.post(url, files={"file": f})
154
- return response.json()
155
-
156
- response_uploaded = await upload_file(file_path)
157
  url = response_uploaded.get("url")
158
  example_test = "Explain how this picture looks like."
159
  x = GeminiLatest(api_keys=GOOGLE_API_KEY)
 
5
  import io
6
  import requests
7
  import os
 
8
  from dotenv import load_dotenv
9
  from pydantic import BaseModel
10
  from pymongo import MongoClient
 
145
  with open(file_path, "wb") as f:
146
  f.write(enhanced_image_bytes.getvalue())
147
 
148
+
149
+ url = "https://randydev-ryuzaki-api.hf.space/api/v1/uploadfile/"
150
+ files = {"file": open(file_path, "rb")}
151
+ response_uploaded = requests.post(url, files=files).json()
 
 
 
 
152
  url = response_uploaded.get("url")
153
  example_test = "Explain how this picture looks like."
154
  x = GeminiLatest(api_keys=GOOGLE_API_KEY)