File size: 744 Bytes
d7550ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from fastapi import FastAPI
from pydantic import BaseModel

# NOTE - we configure docs_url to serve the interactive Docs at the root path
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
app = FastAPI(docs_url="/")

class ModelOutputEvaluate(BaseModel):
    question: str
    answer: str 
    context: str | None = None
    prompt: str
    

# Create extractor instance
@app.post("/evaluate/")
async def create_evaluation_scenario(item: ModelOutputEvaluate):
    output = {
        "input": item,
        "score" : "0"
    }
    return output
# def evaluate(question: str):
#     # question = "what is the document about?"
#     answer = search(question)
#     # print(question, answer)
#     return {answer}