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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -31,9 +31,20 @@ def predict(original_sentence_input, *sentences_to_compare):
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
@@ -43,6 +54,5 @@ gr.Interface(
43
  description="Compute the semantic similarity across various sentences among any African Languages using African-Cross-Lingua-Embeddings-Model.",
44
  inputs=inputs,
45
  outputs=outputs,
46
- cache_examples=False,
47
- allow_flagging="never"
48
  ).launch(debug=True, share=True)
 
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
 
35
+ # Initial sentence comparison inputs
36
+ sentence_to_compare_inputs = [
37
+ gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label="Sentence to Compare 1"),
38
+ gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label="Sentence to Compare 2"),
39
+ gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label="Sentence to Compare 3")
40
+ ]
41
+
42
+ def update_interface(num_sentences):
43
+ return [gr.Textbox(lines=2, placeholder="Enter the sentence you want to compare...", label=f"Sentence to Compare {i}") for i in range(1, num_sentences+1)]
44
+
45
+ num_sentences_input = gr.Slider(minimum=1, maximum=10, step=1, default=3, label="Number of Sentences to Compare")
46
+
47
+ inputs = [model_name_display, original_sentence_input, num_sentences_input] + sentence_to_compare_inputs
48
  outputs = gr.JSON(label="Detailed Similarity Scores")
49
 
50
  # Create Gradio interface
 
54
  description="Compute the semantic similarity across various sentences among any African Languages using African-Cross-Lingua-Embeddings-Model.",
55
  inputs=inputs,
56
  outputs=outputs,
57
+ live=True
 
58
  ).launch(debug=True, share=True)