Hazzzardous commited on
Commit
99dd4f5
1 Parent(s): be6ae85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -17,13 +17,22 @@ def predict(input, history=None):
17
  rr = [(input,r["output"])]
18
  return [*history[0],*rr], [[*history[0],*rr],r["state"]]
19
 
20
- with gr.Blocks() as demo:
21
- chatbot = gr.Chatbot()
22
- state = model.emptyState
23
- state = gr.State([[],state])
24
- with gr.Row():
25
- txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False)
26
-
27
- txt.submit(predict, [txt, state], [chatbot, state])
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  demo.launch()
 
17
  rr = [(input,r["output"])]
18
  return [*history[0],*rr], [[*history[0],*rr],r["state"]]
19
 
20
+ def freegen(input):
21
+ model.resetState()
22
+ return model.loadContext(newctx=input)["output"]
 
 
 
 
 
23
 
24
+ with gr.Blocks() as demo:
25
+ with gr.Tab("Chatbot"):
26
+ chatbot = gr.Chatbot()
27
+ state = model.emptyState
28
+ state = gr.State([[],state])
29
+ with gr.Row():
30
+ txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False)
31
+
32
+ txt.submit(predict, [txt, state], [chatbot, state])
33
+ with gr.Tab("Free Gen"):
34
+ with gr.Row():
35
+ input = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False)
36
+ outtext = gr.Textbox()
37
+ input.submit(freegen,input,outtext)
38
  demo.launch()