kingabzpro commited on
Commit
1354833
·
1 Parent(s): 8e7e7eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -22
app.py CHANGED
@@ -1,27 +1,19 @@
1
  import gradio as gr
2
- import random
3
- import time
4
 
5
- with gr.Blocks() as demo:
6
- chatbot = gr.Chatbot()
7
- msg = gr.Textbox()
8
- clear = gr.ClearButton([msg, chatbot])
9
 
10
- def user(user_message, history):
11
- return gr.update(value="", interactive=False), history + [[user_message, None]]
 
 
 
12
 
13
- def bot(history):
14
- bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
15
- history[-1][1] = ""
16
- for character in bot_message:
17
- history[-1][1] += character
18
- time.sleep(0.05)
19
- yield history
20
 
21
- response = msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
22
- bot, chatbot, chatbot
23
- )
24
- response.then(lambda: gr.update(interactive=True), None, [msg], queue=False)
25
-
26
- demo.queue()
27
- demo.launch()
 
1
  import gradio as gr
 
 
2
 
3
+ title = "Falcon-7B"
 
 
 
4
 
5
+ examples = [
6
+ ["The tower is 324 metres (1,063 ft) tall,"],
7
+ ["The Moon's orbit around Earth has"],
8
+ ["The smooth Borealis basin in the Northern Hemisphere covers 40%"],
9
+ ]
10
 
11
+ demo = gr.load(
12
+ "tiiuae/falcon-7b-instruct",
13
+ inputs=gr.Textbox(lines=5, max_lines=6, label="Input Text"),
14
+ title=title,
15
+ examples=examples,
16
+ )
 
17
 
18
+ if __name__ == "__main__":
19
+ demo.launch()