Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
| 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()
|