Spaces:
Runtime error
Runtime error
Commit ·
0657cdd
1
Parent(s): c554a0a
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from dataset_recommender import DatasetRecommender
|
| 3 |
+
|
| 4 |
+
db_lookup = DatasetRecommender()
|
| 5 |
+
def predict(input_text, option):
|
| 6 |
+
|
| 7 |
+
if option == "Semantic search":
|
| 8 |
+
|
| 9 |
+
response = db_lookup.recommend_based_on_text(input_text)
|
| 10 |
+
output = f"Message: {response['message']} \n Datasets: {', '.join([x for x in response['datasets']])}"
|
| 11 |
+
elif option == 'Dataset similarity':
|
| 12 |
+
response = db_lookup.get_similar_datasets(input_text)
|
| 13 |
+
output = f"Similar Datasets: {', '.join([x for x in response['datasets']])}"
|
| 14 |
+
|
| 15 |
+
else:
|
| 16 |
+
output = "Please select an option"
|
| 17 |
+
return output
|
| 18 |
+
|
| 19 |
+
input_type = gr.inputs.Textbox(label="Input Text")
|
| 20 |
+
checkbox = gr.inputs.Radio(["Semantic search", "Dataset similarity"], label="Please select search type:")
|
| 21 |
+
iface = gr.Interface(fn=predict, inputs=[input_type, checkbox], outputs="text", title="SearchingFace")
|
| 22 |
+
|
| 23 |
+
iface.launch()
|