cahya commited on
Commit
38f57a9
1 Parent(s): 8454eb5

add highlight

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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
- return answer_without_prompt
 
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