Update main.py
Browse files
main.py
CHANGED
|
@@ -6,6 +6,7 @@ from lang import G4F
|
|
| 6 |
from fastapi import FastAPI, Request
|
| 7 |
from pydantic import BaseModel
|
| 8 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
|
|
@@ -55,3 +56,15 @@ async def searches(request: Request):
|
|
| 55 |
response = agent_chain.run(input=prompt)
|
| 56 |
return response
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from fastapi import FastAPI, Request
|
| 7 |
from pydantic import BaseModel
|
| 8 |
from fastapi.middleware.cors import CORSMiddleware
|
| 9 |
+
from ImageCreator import generate_image_prodia
|
| 10 |
|
| 11 |
app = FastAPI()
|
| 12 |
|
|
|
|
| 56 |
response = agent_chain.run(input=prompt)
|
| 57 |
return response
|
| 58 |
|
| 59 |
+
@app.route("/", methods=["POST"])
|
| 60 |
+
def generate_image():
|
| 61 |
+
data = request.get_json()
|
| 62 |
+
prompt = data.get("prompt")
|
| 63 |
+
model = data.get("model")
|
| 64 |
+
sampler = data.get("sampler")
|
| 65 |
+
seed = int(data.get("seed"))
|
| 66 |
+
neg = data.get("neg")
|
| 67 |
+
|
| 68 |
+
response = generate_image_prodia(prompt, model, sampler, seed, neg)
|
| 69 |
+
return jsonify({"image": response})
|
| 70 |
+
|