CogwiseAI commited on
Commit
dcb567b
·
1 Parent(s): edc2aa3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -25,13 +25,16 @@ def generate_text(input_text):
25
  num_return_sequences=1,
26
  eos_token_id=tokenizer.eos_token_id,
27
  )
 
 
28
 
29
  output_text = tokenizer.decode(output[0], skip_special_tokens=True)
30
  print(output_text)
31
 
32
  # Remove Prompt Echo from Generated Text
 
33
  cleaned_output_text = output_text.replace(input_text, "")
34
- return cleaned_output_text
35
 
36
  block = gr.Blocks()
37
 
@@ -39,11 +42,11 @@ block = gr.Blocks()
39
  with block:
40
  gr.Markdown("""<h1><center>CogwiseAI falcon7b</center></h1>
41
  """)
42
- chatbot = gr.Chatbot()
43
  message = gr.Textbox(placeholder='Enter Your Question Here')
44
  state = gr.State()
45
  submit = gr.Button("SEND")
46
- submit.click(generate_text, inputs=[message, state], outputs=[output_text, state])
47
 
48
  block.launch(debug = True)
49
 
 
25
  num_return_sequences=1,
26
  eos_token_id=tokenizer.eos_token_id,
27
  )
28
+
29
+ global cleaned_output_text
30
 
31
  output_text = tokenizer.decode(output[0], skip_special_tokens=True)
32
  print(output_text)
33
 
34
  # Remove Prompt Echo from Generated Text
35
+
36
  cleaned_output_text = output_text.replace(input_text, "")
37
+ return cleaned_output_text
38
 
39
  block = gr.Blocks()
40
 
 
42
  with block:
43
  gr.Markdown("""<h1><center>CogwiseAI falcon7b</center></h1>
44
  """)
45
+ # chatbot = gr.Chatbot()
46
  message = gr.Textbox(placeholder='Enter Your Question Here')
47
  state = gr.State()
48
  submit = gr.Button("SEND")
49
+ submit.click(generate_text, inputs=[message, state], outputs=[cleaned_output_text, state])
50
 
51
  block.launch(debug = True)
52