Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,11 @@ class Technology(BaseModel):
|
|
27 |
limitations: str
|
28 |
id: int
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
# This schema defines the root structure of the JSON
|
31 |
class TechnologyData(BaseModel):
|
32 |
"""Represents the top-level object containing a list of technologies."""
|
@@ -34,14 +39,23 @@ class TechnologyData(BaseModel):
|
|
34 |
|
35 |
@app.post("/process", response_model=TechnologyData)
|
36 |
async def process(data: InputData):
|
37 |
-
result = process_input(data, global_tech, global_tech_embeddings)
|
38 |
-
return {"technologies": result}
|
39 |
-
|
40 |
|
41 |
@app.post("/process-constraints", response_model=TechnologyData)
|
42 |
async def process_constraints(constraints: InputConstraints):
|
43 |
-
result =
|
44 |
-
return {"technologies": result}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
|
47 |
def make_json_serializable(data):
|
|
|
27 |
limitations: str
|
28 |
id: int
|
29 |
|
30 |
+
class PriorArt(BaseModel):
|
31 |
+
"""Represents the search of prior art using the technology combinations"""
|
32 |
+
content: str
|
33 |
+
uris: List
|
34 |
+
|
35 |
# This schema defines the root structure of the JSON
|
36 |
class TechnologyData(BaseModel):
|
37 |
"""Represents the top-level object containing a list of technologies."""
|
|
|
39 |
|
40 |
@app.post("/process", response_model=TechnologyData)
|
41 |
async def process(data: InputData):
|
42 |
+
result, prior_art = process_input(data, global_tech, global_tech_embeddings, "problem")
|
43 |
+
return {"technologies": result, "prior_art": prior_art}
|
|
|
44 |
|
45 |
@app.post("/process-constraints", response_model=TechnologyData)
|
46 |
async def process_constraints(constraints: InputConstraints):
|
47 |
+
result, prior_art = process_input(constraints.constraints, global_tech, global_tech_embeddings, "constraints")
|
48 |
+
return {"technologies": result, "prior_art": prior_art}
|
49 |
+
|
50 |
+
@app.post("/prior-art-constraints", response_model=PriorArt)
|
51 |
+
async def prior_art_search(technologies: TechnologyData, constraints: InputConstraints, type: str):
|
52 |
+
prior_art = process_prior_art(technologies, constraints, type)
|
53 |
+
return prior_art
|
54 |
+
|
55 |
+
@app.post("/prior-art-problems", response_model=PriorArt)
|
56 |
+
async def prior_art_search(technologies: TechnologyData, problems: InputData, type: str):
|
57 |
+
prior_art = process_prior_art(technologies, problems, type)
|
58 |
+
return prior_art
|
59 |
|
60 |
|
61 |
def make_json_serializable(data):
|