EMsurya commited on
Commit
9d34576
·
verified ·
1 Parent(s): 1ac872c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -44
app.py CHANGED
@@ -33,51 +33,22 @@ def lechat_respond(
33
  yield response
34
 
35
 
36
- # #chat interface for le_chat
37
- # mistral_chat = gr.ChatInterface(
38
- # fn = lechat_respond,
39
- # type = 'messages',
40
- # chatbot = gr.Chatbot(placeholder = "<h5>LLM running on cpu so it may take long time to respond to ur prompt !</h5>"),
41
- # textbox = gr.Textbox(placeholder= "Ask whatever", scale = 7, container = False),
42
- # additional_inputs=[
43
- # gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
44
- # gr.Slider(minimum=0.1, maximum=4.0, value=0.8, step=0.1, label="Temperature"),
45
- # gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p (nucleus sampling)"),
46
- # gr.Slider(minimum = 40, maximum = 10000, value = 40, step = 10, label = "Top-k"),
47
- # ],
48
- # theme= "ocean",
49
- # examples= [["Write a haiku about destruction of human's and the raise of AI"], ["Which species will rule the Earth in the future"]],
50
- # cache_examples = True
51
- # )
52
-
53
  #chat interface for le_chat
54
- with gr.Blocks(theme = "gradio/ocean") as mistral_chat:
55
- gr.Markdown("## LeChat ")
56
- chatbot = gr.Chatbot(placeholder = "<h5>LLM running on cpu so it may take long time to respond to ur prompt !</h5>")
57
-
58
- with gr.Row():
59
- txt = gr.Textbox(placeholder = "Ask whatever")
60
- send = gr.Button("Send")
61
-
62
- max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
63
- temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.8, step=0.1, label="Temperature")
64
- top_p = gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p (nucleus sampling)")
65
- top_k = gr.Slider(minimum = 40, maximum = 10000, value = 40, step = 10, label = "Top-k")
66
-
67
- examples = gr.Examples(
68
- examples=[
69
- ["Write a haiku about the destruction of humans and the rise of AI"],
70
- ["Which species will rule the Earth in the future?"]
71
- ],
72
- inputs=[txt]
73
- )
74
-
75
- send.click(
76
- fn = lechat_respond,
77
- inputs = [txt, chatbot, max_tokens, temperature, top_p, top_k],
78
- outputs = chatbot,
79
- queue = True
80
- )
81
 
82
  if __name__ == "__main__":
83
  mistral_chat.launch()
 
33
  yield response
34
 
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  #chat interface for le_chat
37
+ mistral_chat = gr.ChatInterface(
38
+ fn = lechat_respond,
39
+ type = 'messages',
40
+ # chatbot = gr.Chatbot(placeholder = "<h5>LLM running on cpu so it may take long time to respond to ur prompt !</h5>"),
41
+ # textbox = gr.Textbox(placeholder= "Ask whatever", scale = 7, container = False),
42
+ additional_inputs=[
43
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
44
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.8, step=0.1, label="Temperature"),
45
+ gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p (nucleus sampling)"),
46
+ gr.Slider(minimum = 40, maximum = 10000, value = 40, step = 10, label = "Top-k"),
47
+ ],
48
+ # theme= "ocean",
49
+ # examples= [["Write a haiku about destruction of human's and the raise of AI"], ["Which species will rule the Earth in the future"]],
50
+ # cache_examples = True
51
+ )
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  if __name__ == "__main__":
54
  mistral_chat.launch()