RoAr777 commited on
Commit
4585e4b
·
1 Parent(s): 49b1871

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
3
  prompt=''' Review the Following text as a human, who is tasked to Extract `Code Snippets` ,if any. If there are no Code Snippets in the below Text then return No CODE HIDDEN:
4
 
@@ -16,7 +17,9 @@ def chatbot_model(m,history):
16
 
17
  # Decode the output
18
  decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
19
- return decoded_output
 
 
20
 
21
- iface = gr.ChatInterface(chatbot_model)
22
  iface.launch()
 
1
  import gradio as gr
2
+ import time
3
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
4
  prompt=''' Review the Following text as a human, who is tasked to Extract `Code Snippets` ,if any. If there are no Code Snippets in the below Text then return No CODE HIDDEN:
5
 
 
17
 
18
  # Decode the output
19
  decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
20
+ for i in range(len(decoded_output)):
21
+ time.sleep(0.3)
22
+ yield decoded_output[:i+1]
23
 
24
+ iface = gr.ChatInterface(chatbot_model,title="Code Detector",undo_btn=None,theme="soft").queue()
25
  iface.launch()