Update app.py
Browse files
app.py
CHANGED
@@ -46,11 +46,9 @@ def model(prompt):
|
|
46 |
analyzed_paraphrased_sentences, selected_sentences, discarded_sentences = analyze_entailment(sentence, paraphrased_sentences, 0.7)
|
47 |
common_grams = find_common_subsequences(sentence, selected_sentences)
|
48 |
highlighted_user_prompt = highlight_common_words(common_grams, [sentence], "User Prompt (Highlighted and Numbered)") # Pass the sentence as a list
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
tree = generate_plot(sentence)
|
53 |
-
return highlighted_user_prompt, highlighted_selected_sentences, highlighted_discarded_sentences, tree
|
54 |
|
55 |
|
56 |
with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
@@ -67,17 +65,14 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
67 |
highlighted_user_prompt = gr.HTML()
|
68 |
|
69 |
with gr.Row():
|
70 |
-
|
71 |
-
|
72 |
-
with gr.Row():
|
73 |
-
highlighted_discarded_sentences = gr.HTML()
|
74 |
|
75 |
with gr.Row():
|
76 |
tree = gr.Plot()
|
77 |
|
78 |
-
submit_button.click(model, inputs=user_input, outputs=[highlighted_user_prompt,
|
79 |
clear_button.click(lambda: "", inputs=None, outputs=user_input)
|
80 |
-
clear_button.click(lambda: "", inputs=None, outputs=[highlighted_user_prompt,
|
81 |
|
82 |
# Launch the demo
|
83 |
demo.launch(share=True)
|
|
|
46 |
analyzed_paraphrased_sentences, selected_sentences, discarded_sentences = analyze_entailment(sentence, paraphrased_sentences, 0.7)
|
47 |
common_grams = find_common_subsequences(sentence, selected_sentences)
|
48 |
highlighted_user_prompt = highlight_common_words(common_grams, [sentence], "User Prompt (Highlighted and Numbered)") # Pass the sentence as a list
|
49 |
+
highlighted_paraphrased_sentences = highlight_common_words_dict(common_grams, selected_sentences, discarded_sentences, "Sentences Generated by the Paraphraser")
|
50 |
+
tree = generate_plot(sentence, list(selected_sentences.keys()))
|
51 |
+
return highlighted_user_prompt, highlighted_paraphrased_sentences, tree
|
|
|
|
|
52 |
|
53 |
|
54 |
with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
|
65 |
highlighted_user_prompt = gr.HTML()
|
66 |
|
67 |
with gr.Row():
|
68 |
+
highlighted_paraphrased_sentences = gr.HTML()
|
|
|
|
|
|
|
69 |
|
70 |
with gr.Row():
|
71 |
tree = gr.Plot()
|
72 |
|
73 |
+
submit_button.click(model, inputs=user_input, outputs=[highlighted_user_prompt, highlighted_paraphrased_sentences, tree])
|
74 |
clear_button.click(lambda: "", inputs=None, outputs=user_input)
|
75 |
+
clear_button.click(lambda: "", inputs=None, outputs=[highlighted_user_prompt, highlighted_paraphrased_sentences, tree])
|
76 |
|
77 |
# Launch the demo
|
78 |
demo.launch(share=True)
|