pedromsfaria commited on
Commit
e2d31fe
·
1 Parent(s): 69edcd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -65,18 +65,6 @@ def openai_create(user_input):
65
 
66
 
67
 
68
- def chatgpt_clone(input, history):
69
- history = history or []
70
- s = list(sum(history, ()))
71
- s.append(input)
72
- inp = ' '.join(s)
73
- output = openai_create(inp)
74
- history.append((input, output))
75
- time.sleep(2)
76
- return history, history
77
-
78
-
79
-
80
 
81
  block = gr.Blocks(css=".gradio-container {background: url('file=fundo.jpg'); background-size: contain;}")
82
 
@@ -94,9 +82,17 @@ with block:
94
  ],
95
  state = gr.State()
96
  clear = gr.ClearButton([message, chatbot])
97
- message.submit(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
98
- #submit = gr.Button("Enviar")
99
- #submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
 
 
 
 
 
 
 
100
 
101
- # msg.submit(respond, [msg, chatbot], [msg, chatbot])
 
102
  block.launch()
 
65
 
66
 
67
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  block = gr.Blocks(css=".gradio-container {background: url('file=fundo.jpg'); background-size: contain;}")
70
 
 
82
  ],
83
  state = gr.State()
84
  clear = gr.ClearButton([message, chatbot])
85
+
86
+ def chatgpt_clone(input, history):
87
+ history = history or []
88
+ s = list(sum(history, ()))
89
+ s.append(input)
90
+ inp = ' '.join(s)
91
+ output = openai_create(inp)
92
+ history.append((input, output))
93
+ time.sleep(2)
94
+ return "", history
95
 
96
+ message.submit(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
97
+
98
  block.launch()