File size: 829 Bytes
0aba22c
c6b1807
 
 
 
 
 
 
 
 
4d247a3
 
 
c6b1807
 
 
 
5b92634
c6b1807
0aba22c
c6b1807
 
5b92634
c6b1807
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from fastapi import FastAPI
from dialogue_generator import (
    generate_response,
    generate_response_from_audio,
    generate_response_from_webcam,
    DialogueOutput,
    TextDialogueInput,
    AudioDialogueInput,
    WebcamDialogueInput
)

app = FastAPI()

@app.post("/process_text", response_model=DialogueOutput)
async def process_dialogue(dialogue: TextDialogueInput):
    response = generate_response(dialogue)
    return response

@app.post("/process_audio", response_model=DialogueOutput)
async def process_dialogue(dialogue: AudioDialogueInput):
    response = generate_response_from_audio(dialogue)
    return response

@app.post("/process_images", response_model=DialogueOutput)
async def process_dialogue(dialogue: WebcamDialogueInput):
    response = generate_response_from_webcam(dialogue)
    return response