Spaces:
Runtime error
Runtime error
Commit
·
707e941
1
Parent(s):
b22953d
Remove fastapi, add invisible button (very dirty)
Browse files
app.py
CHANGED
@@ -7,8 +7,6 @@ from llama_index import (
|
|
7 |
)
|
8 |
import chromadb
|
9 |
import typing_extensions
|
10 |
-
from fastapi import FastAPI, File, UploadFile, Request
|
11 |
-
from fastapi.responses import JSONResponse
|
12 |
|
13 |
|
14 |
from llama_index.llms import MistralAI
|
@@ -51,7 +49,6 @@ index = VectorStoreIndex(
|
|
51 |
)
|
52 |
query_engine = index.as_query_engine(similarity_top_k=5)
|
53 |
|
54 |
-
app = FastAPI()
|
55 |
|
56 |
# Structure of the data sent by the form
|
57 |
InputForm = typing_extensions.TypedDict('InputForm', {
|
@@ -63,9 +60,8 @@ InputForm = typing_extensions.TypedDict('InputForm', {
|
|
63 |
})
|
64 |
|
65 |
# This function is the API endpoint the web app will use
|
66 |
-
@app.post("/find-my-rotation")
|
67 |
def find_my_rotation(input: InputForm):
|
68 |
-
return
|
69 |
|
70 |
|
71 |
def get_documents_in_db():
|
@@ -178,6 +174,9 @@ with gr.Blocks() as demo:
|
|
178 |
|
179 |
msg.submit(respond, [msg, chatbot], [chatbot])
|
180 |
|
|
|
|
|
|
|
181 |
demo.title = title
|
182 |
|
183 |
demo.launch()
|
|
|
7 |
)
|
8 |
import chromadb
|
9 |
import typing_extensions
|
|
|
|
|
10 |
|
11 |
|
12 |
from llama_index.llms import MistralAI
|
|
|
49 |
)
|
50 |
query_engine = index.as_query_engine(similarity_top_k=5)
|
51 |
|
|
|
52 |
|
53 |
# Structure of the data sent by the form
|
54 |
InputForm = typing_extensions.TypedDict('InputForm', {
|
|
|
60 |
})
|
61 |
|
62 |
# This function is the API endpoint the web app will use
|
|
|
63 |
def find_my_rotation(input: InputForm):
|
64 |
+
return "Hi, you. Your farm is " + input["farmSize"] + "ha"
|
65 |
|
66 |
|
67 |
def get_documents_in_db():
|
|
|
174 |
|
175 |
msg.submit(respond, [msg, chatbot], [chatbot])
|
176 |
|
177 |
+
invisible_btn = gr.Button(visible=False)
|
178 |
+
invisible_btn.click(find_my_rotation)
|
179 |
+
|
180 |
demo.title = title
|
181 |
|
182 |
demo.launch()
|