Spaces:
Runtime error
Runtime error
Commit
·
013e46d
1
Parent(s):
4731c3b
Add find_my_rotation function
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from llama_index import (
|
|
6 |
download_loader,
|
7 |
)
|
8 |
import chromadb
|
|
|
9 |
|
10 |
from llama_index.llms import MistralAI
|
11 |
from llama_index.embeddings import MistralAIEmbedding
|
@@ -47,6 +48,19 @@ index = VectorStoreIndex(
|
|
47 |
)
|
48 |
query_engine = index.as_query_engine(similarity_top_k=5)
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
def get_documents_in_db():
|
52 |
print("Fetching documents in DB")
|
|
|
6 |
download_loader,
|
7 |
)
|
8 |
import chromadb
|
9 |
+
from typing import TypedDict
|
10 |
|
11 |
from llama_index.llms import MistralAI
|
12 |
from llama_index.embeddings import MistralAIEmbedding
|
|
|
48 |
)
|
49 |
query_engine = index.as_query_engine(similarity_top_k=5)
|
50 |
|
51 |
+
# Structure of the data sent by the form
|
52 |
+
InputForm = TypedDict('InputForm', {
|
53 |
+
'department': str,
|
54 |
+
'farmSize': float,
|
55 |
+
'benefitsFromCommonAgriculturalPolicy': bool,
|
56 |
+
'cultures': list[str],
|
57 |
+
'yields': dict[str, float]
|
58 |
+
})
|
59 |
+
|
60 |
+
# This function is the API endpoint the web app will use
|
61 |
+
def find_my_rotation(input: InputForm):
|
62 |
+
return "Hi, you. Your farm is " + input["farmSize"] + "ha"
|
63 |
+
|
64 |
|
65 |
def get_documents_in_db():
|
66 |
print("Fetching documents in DB")
|