RoAr777 commited on
Commit
eb73c1c
·
1 Parent(s): 375da9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -9,18 +9,10 @@ tokenizer = AutoTokenizer.from_pretrained("google/flan-ul2")
9
 
10
 
11
 
12
- def reply(message, history):
13
- m=message.replace('\n','')
14
- m=m.replace('\t','')
15
- inputs = tokenizer(f''' 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:
16
-
17
- "{message}"
18
- ''', return_tensors="pt")
19
- outputs = model.generate(**inputs)
20
- code=tokenizer.batch_decode(outputs, skip_special_tokens=True)
21
- return code
22
-
23
- demo = gr.ChatInterface(reply)
24
-
25
- if __name__ == "__main__":
26
- demo.launch()
 
9
 
10
 
11
 
12
+
13
+ def slow_echo(message, history):
14
+ for i in range(len(message)):
15
+ time.sleep(0.3)
16
+ yield "You typed: " + message[: i+1]
17
+
18
+ gr.ChatInterface(slow_echo).queue().launch()