focusit commited on
Commit
fb8c433
·
1 Parent(s): 5b58e89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -20
app.py CHANGED
@@ -14,10 +14,7 @@ load_dotenv()
14
 
15
  bardkey = os.environ.get('_BARD_API_KEY')
16
 
17
-
18
  def bardChat(data):
19
-
20
-
21
  # Create a session object using the requests library
22
  session = requests.Session()
23
 
@@ -41,11 +38,6 @@ def bardChat(data):
41
  # return json.dumps({'message':answer,'action':'null'})
42
 
43
 
44
-
45
-
46
-
47
-
48
-
49
  def responsenew(data):
50
 
51
  idval = str(uuid.uuid4())
@@ -215,18 +207,29 @@ def responsenew(data):
215
  return jdata
216
 
217
 
218
- with gr.Blocks() as demo:
219
- chatbot = gr.Chatbot()
220
- msg = gr.Textbox()
221
- # clear = gr.ClearButton([msg, chatbot])
 
 
 
 
 
 
 
 
222
 
223
- def respond(message, chat_history):
224
- bot_message = responsenew(message)
225
- chat_history.append((message, bot_message))
226
- time.sleep(2)
227
- return "", chat_history
228
 
229
- msg.submit(respond, [msg, chatbot], [msg, chatbot])
 
 
230
 
231
- if __name__ == "__main__":
232
- demo.launch()
 
 
 
 
 
14
 
15
  bardkey = os.environ.get('_BARD_API_KEY')
16
 
 
17
  def bardChat(data):
 
 
18
  # Create a session object using the requests library
19
  session = requests.Session()
20
 
 
38
  # return json.dumps({'message':answer,'action':'null'})
39
 
40
 
 
 
 
 
 
41
  def responsenew(data):
42
 
43
  idval = str(uuid.uuid4())
 
207
  return jdata
208
 
209
 
210
+ # with gr.Blocks() as demo:
211
+ # chatbot = gr.Chatbot()
212
+ # msg = gr.Textbox()
213
+ # # clear = gr.ClearButton([msg, chatbot])
214
+
215
+ # def respond(message, chat_history):
216
+ # bot_message = responsenew(message)
217
+ # chat_history.append((message, bot_message))
218
+ # time.sleep(2)
219
+ # return "", chat_history
220
+
221
+ # msg.submit(respond, [msg, chatbot], [msg, chatbot])
222
 
223
+ # if __name__ == "__main__":
224
+ # demo.launch()
 
 
 
225
 
226
+ def responsedata(data):
227
+ return bardChat(data)
228
+
229
 
230
+ gradio_interface = gradio.Interface(
231
+ fn = responsedata,
232
+ inputs = "text",
233
+ outputs = "text"
234
+ )
235
+ gradio_interface.launch()