Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -27,16 +27,10 @@ def get_similarity_scores(queries: list, passages: list, model, tokenizer):
27
  scores = (embeddings[:len(queries)] @ embeddings[len(queries):].T) * 100
28
  return scores.tolist()
29
 
30
- def similarity_ui(keyName, field1, field2, field3):
31
  task = 'Given a keyName, find similarity score against provided fields'
32
- queries = [
33
- keyName
34
- ]
35
- passages = [
36
- field1,
37
- field2,
38
- field3
39
- ]
40
 
41
  scores = get_similarity_scores(queries, passages, model, tokenizer)
42
  return {'Similarity Scores': scores}
@@ -48,7 +42,7 @@ model = AutoModel.from_pretrained('Salesforce/SFR-Embedding-Mistral')
48
  # Create Gradio Interface
49
  gr.Interface(
50
  fn=similarity_ui,
51
- inputs=["text", "text","text","text",],
52
  outputs="text",
53
  title="Similarity Score Calculator",
54
  description="Enter a Key Name and 3 Fields to find similarity scores"
 
27
  scores = (embeddings[:len(queries)] @ embeddings[len(queries):].T) * 100
28
  return scores.tolist()
29
 
30
+ def similarity_ui(keyNames:list, fields:list):
31
  task = 'Given a keyName, find similarity score against provided fields'
32
+ queries = keyNames
33
+ passages = fields
 
 
 
 
 
 
34
 
35
  scores = get_similarity_scores(queries, passages, model, tokenizer)
36
  return {'Similarity Scores': scores}
 
42
  # Create Gradio Interface
43
  gr.Interface(
44
  fn=similarity_ui,
45
+ inputs="text", "text",
46
  outputs="text",
47
  title="Similarity Score Calculator",
48
  description="Enter a Key Name and 3 Fields to find similarity scores"