Update main.py
Browse files
main.py
CHANGED
@@ -56,28 +56,26 @@ async def searches(request: Request):
|
|
56 |
response = agent_chain.run(input=prompt)
|
57 |
return response
|
58 |
|
59 |
-
@app.post("/imagen")
|
60 |
-
async def generate_image(request: Request):
|
61 |
-
data = await request.json()
|
62 |
-
prompt = data['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 |
-
|
71 |
class User(BaseModel):
|
72 |
prompt: str
|
73 |
model: str
|
74 |
sampler: str
|
75 |
seed: int
|
76 |
neg: str = None
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
@app.post("/test")
|
81 |
def test(request: User):
|
82 |
-
return {'data': f'Prompt is {request.prompt}'}
|
83 |
|
|
|
56 |
response = agent_chain.run(input=prompt)
|
57 |
return response
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
class User(BaseModel):
|
60 |
prompt: str
|
61 |
model: str
|
62 |
sampler: str
|
63 |
seed: int
|
64 |
neg: str = None
|
65 |
+
|
66 |
+
@app.post("/imagen")
|
67 |
+
def generate_image(request: User):
|
68 |
+
prompt = request.prompt
|
69 |
+
model = request.model
|
70 |
+
sampler = request.sampler
|
71 |
+
seed = request.seed
|
72 |
+
neg = request.neg
|
73 |
+
|
74 |
+
response = generate_image_prodia(prompt, model, sampler, seed, neg)
|
75 |
+
return {"image": response}
|
76 |
+
|
77 |
|
78 |
@app.post("/test")
|
79 |
def test(request: User):
|
80 |
+
return {'data': f'Prompt is {request.prompt} Model is {request.model}'}
|
81 |
|