AndriiPets commited on
Commit
692fe6e
·
1 Parent(s): 62aba98

switched to fastapi

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -25,16 +25,16 @@ def hello():
25
  return {"massage": "we are running!"}
26
 
27
 
28
- @app.post("/generate/")
29
- def generate(prompt: Prompt):
30
- request_data = prompt.dict()
31
 
32
- text = request_data["prompts"]
33
 
34
- if request_data.get("lang"):
35
  generated_recepie = generation_function(
36
- text, lang=request_data["lang"])
37
  else:
38
- generated_recepie = generation_function(text)
39
 
40
  return generated_recepie
 
25
  return {"massage": "we are running!"}
26
 
27
 
28
+ @app.get("/generate/")
29
+ def generate(prompt: str, lang: str):
30
+ # request_data = prompt.dict()
31
 
32
+ # text = request_data["prompts"]
33
 
34
+ if lang:
35
  generated_recepie = generation_function(
36
+ prompt, lang=lang)
37
  else:
38
+ generated_recepie = generation_function(prompt)
39
 
40
  return generated_recepie