Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,11 @@ class TextInput(BaseModel):
|
|
14 |
class EmbeddingOutput(BaseModel):
|
15 |
embedding: List[float]
|
16 |
|
|
|
|
|
|
|
|
|
17 |
@app.get("/encode_text/{text}", response_model=EmbeddingOutput)
|
18 |
-
async def encode_text(
|
19 |
-
|
20 |
-
model = ProdFeatureEncoder(config=config)
|
21 |
-
embedding = model(text_input.text)
|
22 |
return {"embedding": embedding.tolist()}
|
23 |
-
|
|
|
14 |
class EmbeddingOutput(BaseModel):
|
15 |
embedding: List[float]
|
16 |
|
17 |
+
|
18 |
+
config = ModelConfig()
|
19 |
+
model = ProdFeatureEncoder(config=config)
|
20 |
+
|
21 |
@app.get("/encode_text/{text}", response_model=EmbeddingOutput)
|
22 |
+
async def encode_text(text: str):
|
23 |
+
embedding = model(text)
|
|
|
|
|
24 |
return {"embedding": embedding.tolist()}
|
|