Commit
•
d7550ad
1
Parent(s):
2447a96
Update evaluate.py
Browse files- evaluate.py +27 -0
evaluate.py
CHANGED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
from pydantic import BaseModel
|
3 |
+
|
4 |
+
# NOTE - we configure docs_url to serve the interactive Docs at the root path
|
5 |
+
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
|
6 |
+
app = FastAPI(docs_url="/")
|
7 |
+
|
8 |
+
class ModelOutputEvaluate(BaseModel):
|
9 |
+
question: str
|
10 |
+
answer: str
|
11 |
+
context: str | None = None
|
12 |
+
prompt: str
|
13 |
+
|
14 |
+
|
15 |
+
# Create extractor instance
|
16 |
+
@app.post("/evaluate/")
|
17 |
+
async def create_evaluation_scenario(item: ModelOutputEvaluate):
|
18 |
+
output = {
|
19 |
+
"input": item,
|
20 |
+
"score" : "0"
|
21 |
+
}
|
22 |
+
return output
|
23 |
+
# def evaluate(question: str):
|
24 |
+
# # question = "what is the document about?"
|
25 |
+
# answer = search(question)
|
26 |
+
# # print(question, answer)
|
27 |
+
# return {answer}
|