innocent-charles commited on
Commit
948505c
1 Parent(s): 964330b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -7,7 +7,8 @@ def load_model(model_name):
7
  return SentenceTransformer(model_name)
8
 
9
  # Function to compute similarity and classify relationship
10
- def predict(model_name, original_sentence_input, *sentences_to_compare):
 
11
  model = load_model(model_name)
12
  result = {
13
  "Model Name": model_name,
@@ -28,11 +29,11 @@ def predict(model_name, original_sentence_input, *sentences_to_compare):
28
  return result
29
 
30
  # Define inputs and outputs for Gradio interface
31
- model_name = gr.Textbox(value="sartifyllc/African-Cross-Lingua-Embeddings-Model", label="Model Name")
32
  original_sentence_input = gr.Textbox(lines=2, placeholder="Enter the original sentence here...", label="Original Sentence")
33
- sentence_to_compare_inputs = gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label="Sentence to Compare", elem_id="sentence_to_compare")
34
 
35
- inputs = [model_name, original_sentence_input, sentence_to_compare_inputs]
36
  outputs = gr.JSON(label="Detailed Similarity Scores")
37
 
38
  # Create Gradio interface
 
7
  return SentenceTransformer(model_name)
8
 
9
  # Function to compute similarity and classify relationship
10
+ def predict(original_sentence_input, *sentences_to_compare):
11
+ model_name = "sartifyllc/African-Cross-Lingua-Embeddings-Model"
12
  model = load_model(model_name)
13
  result = {
14
  "Model Name": model_name,
 
29
  return result
30
 
31
  # Define inputs and outputs for Gradio interface
32
+ model_name_display = gr.Markdown(value="**Model Name**: sartifyllc/African-Cross-Lingua-Embeddings-Model")
33
  original_sentence_input = gr.Textbox(lines=2, placeholder="Enter the original sentence here...", label="Original Sentence")
34
+ sentence_to_compare_inputs = gr.Dataset(components=[gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label=f"Sentence to Compare {i}") for i in range(1, 4)], label="Sentences to Compare", datatype="str")
35
 
36
+ inputs = [model_name_display, original_sentence_input, sentence_to_compare_inputs]
37
  outputs = gr.JSON(label="Detailed Similarity Scores")
38
 
39
  # Create Gradio interface