5m4ck3r commited on
Commit
43da070
·
verified ·
1 Parent(s): 34651a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -16,7 +16,7 @@ def chat(refrence: str, passage: str) -> str:
16
  text = f"Read the following references:\n{refrence}\nPlease identify all the errors in the following text using the information in the references provided and suggest edits if necessary:\n[Text] {passage}\n[Edited] "
17
  outputs = pipe(text)
18
  print(outputs)
19
- output = outputs[0]['generated_text']
20
  output = output.replace("<mark>", "<span style='color: green; font-weight: bold;'> ")
21
  output = output.replace("</mark>", " </span>")
22
  output = output.replace("<delete>", "<span style='color: red; text-decoration: line-through;'>")
@@ -42,7 +42,6 @@ with gr.Blocks() as demo:
42
  refrence = gr.Textbox(label="Refrence", placeholder="Enter your Refrence here")
43
  passage = gr.Textbox(label="Passage", placeholder="Enter your passage")
44
  submit_btn = gr.Button("Submit")
45
- output_text = gr.Textbox(label="Result")
46
- submit_btn.click(fn=chat, inputs=[refrence, passage], outputs=output_text)
47
 
48
  demo.launch()
 
16
  text = f"Read the following references:\n{refrence}\nPlease identify all the errors in the following text using the information in the references provided and suggest edits if necessary:\n[Text] {passage}\n[Edited] "
17
  outputs = pipe(text)
18
  print(outputs)
19
+ output = outputs[0]['generated_text'].split("[Edited]")[1]
20
  output = output.replace("<mark>", "<span style='color: green; font-weight: bold;'> ")
21
  output = output.replace("</mark>", " </span>")
22
  output = output.replace("<delete>", "<span style='color: red; text-decoration: line-through;'>")
 
42
  refrence = gr.Textbox(label="Refrence", placeholder="Enter your Refrence here")
43
  passage = gr.Textbox(label="Passage", placeholder="Enter your passage")
44
  submit_btn = gr.Button("Submit")
45
+ submit_btn.click(fn=chat, inputs=[refrence, passage], outputs=gr.HTML("Output result"))
 
46
 
47
  demo.launch()