Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,10 @@ app = Flask(__name__)
|
|
7 |
# Initialize the Gradio client
|
8 |
gradio_client = Client("bhlewis/BERT-for-Patents_Semantic-Patent-Finder-v2")
|
9 |
|
|
|
|
|
|
|
|
|
10 |
@app.route('/api/predict', methods=['POST'])
|
11 |
def predict():
|
12 |
try:
|
@@ -18,8 +22,8 @@ def predict():
|
|
18 |
print(f"Top K: {top_k}")
|
19 |
|
20 |
result = gradio_client.predict(
|
21 |
-
query,
|
22 |
-
top_k,
|
23 |
api_name="/predict"
|
24 |
)
|
25 |
|
|
|
7 |
# Initialize the Gradio client
|
8 |
gradio_client = Client("bhlewis/BERT-for-Patents_Semantic-Patent-Finder-v2")
|
9 |
|
10 |
+
@app.route('/')
|
11 |
+
def home():
|
12 |
+
return "Server is running. Use /api/predict for predictions."
|
13 |
+
|
14 |
@app.route('/api/predict', methods=['POST'])
|
15 |
def predict():
|
16 |
try:
|
|
|
22 |
print(f"Top K: {top_k}")
|
23 |
|
24 |
result = gradio_client.predict(
|
25 |
+
query=query,
|
26 |
+
top_k=top_k,
|
27 |
api_name="/predict"
|
28 |
)
|
29 |
|