text-generation / evaluate.py
BhanuPrakashSamoju's picture
Update evaluate.py
d7550ad
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}