Jofthomas HF staff commited on
Commit
a309f78
1 Parent(s): b1d8b1a

Update TextGen/router.py

Browse files
Files changed (1) hide show
  1. TextGen/router.py +8 -2
TextGen/router.py CHANGED
@@ -16,6 +16,12 @@ from langchain_google_genai import (
16
  from TextGen import app
17
  from gradio_client import Client
18
 
 
 
 
 
 
 
19
  song_base_api=os.environ["VERCEL_API"]
20
 
21
  my_hf_token=os.environ["HF_TOKEN"]
@@ -64,8 +70,8 @@ def api_home():
64
  return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
65
 
66
  @app.post("/api/generate", summary="Generate text from prompt", tags=["Generate"], response_model=Generate)
67
- def inference(input_prompt: str):
68
- return generate_text(prompt=input_prompt)
69
 
70
 
71
  @app.get("/generate_wav")
 
16
  from TextGen import app
17
  from gradio_client import Client
18
 
19
+
20
+ class Message(BaseModel):
21
+ npc: str | None = None
22
+ input: str | None = None
23
+
24
+
25
  song_base_api=os.environ["VERCEL_API"]
26
 
27
  my_hf_token=os.environ["HF_TOKEN"]
 
70
  return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
71
 
72
  @app.post("/api/generate", summary="Generate text from prompt", tags=["Generate"], response_model=Generate)
73
+ def inference(message: Message):
74
+ return generate_text(prompt=message.input)
75
 
76
 
77
  @app.get("/generate_wav")