add highlight
Browse files
app.py
CHANGED
@@ -28,7 +28,8 @@ def get_answer(user_input, decoding_methods, num_beams, top_k, top_p, temperatur
|
|
28 |
penalty_alpha=penalty_alpha)
|
29 |
answer = generated_text[0]["generated_text"]
|
30 |
answer_without_prompt = answer[len(prompt)+1:]
|
31 |
-
|
|
|
32 |
|
33 |
|
34 |
with gr.Blocks() as demo:
|
@@ -53,7 +54,11 @@ with gr.Blocks() as demo:
|
|
53 |
with gr.Row():
|
54 |
button_generate_story = gr.Button("Submit")
|
55 |
with gr.Column():
|
56 |
-
generated_answer = gr.Textbox()
|
|
|
|
|
|
|
|
|
57 |
with gr.Row():
|
58 |
gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=cahya_indochat)")
|
59 |
|
|
|
28 |
penalty_alpha=penalty_alpha)
|
29 |
answer = generated_text[0]["generated_text"]
|
30 |
answer_without_prompt = answer[len(prompt)+1:]
|
31 |
+
|
32 |
+
return [(f"{user_input} ", None), (answer_without_prompt, "")]
|
33 |
|
34 |
|
35 |
with gr.Blocks() as demo:
|
|
|
54 |
with gr.Row():
|
55 |
button_generate_story = gr.Button("Submit")
|
56 |
with gr.Column():
|
57 |
+
# generated_answer = gr.Textbox()
|
58 |
+
generated_answer = gr.HighlightedText(
|
59 |
+
label="Answer",
|
60 |
+
combine_adjacent=True,
|
61 |
+
).style(color_map={"": "blue", "-": "green"})
|
62 |
with gr.Row():
|
63 |
gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=cahya_indochat)")
|
64 |
|