nitinbhayana commited on
Commit
6ac529c
1 Parent(s): 6650ff5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -1,15 +1,20 @@
1
  import gradio as gr
2
-
3
- #gr.load("models/WhereIsAI/UAE-Large-V1").launch()
4
-
5
- # Use a pipeline as a high-level helper
6
  from transformers import pipeline
7
 
8
- pipe = pipeline("feature-extraction", model="WhereIsAI/UAE-Large-V1")
9
 
10
- gr.Interface(
 
 
 
 
 
 
11
  predict,
12
  inputs='text',
13
  outputs='text',
14
- title="Mapping",
15
- ).launch()
 
 
 
 
1
  import gradio as gr
 
 
 
 
2
  from transformers import pipeline
3
 
4
+ pipeline = pipeline("feature-extraction", model="WhereIsAI/UAE-Large-V1")
5
 
6
+ def similarity(text):
7
+ title_embedding = pipeline(text)
8
+ term_embedding = pipeline('multivitamin for men')
9
+ semantic_score = cosine_similarity(title_embedding.flatten(), term_embedding.flatten()) * 100
10
+ return str(format(semantic_score,'.2f'))
11
+
12
+ gradio_app = gr.Interface(
13
  predict,
14
  inputs='text',
15
  outputs='text',
16
+ title="Yes Or No?",
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ gradio_app.launch()