Kvikontent commited on
Commit
c652bdc
·
1 Parent(s): d519a89

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import gradio as gr
3
+ import bardapi
4
+
5
+ # Set your Secure-1PSID value to token
6
+ token = 'cQjDrFOQjkhOHHHCW54Tc7IKyphnqos-A-IpmgjVa9p3_ZFFa5Ilet-heMO8Xm3TM1Y5vw.'
7
+
8
+ def get_spaces_response(message, history):
9
+ # Send an API request and get a response
10
+ response = bardapi.core.Bard(token).get_answer(message)
11
+ return response["answers"][0]["answer"]
12
+
13
+ chatbot = gr.ChatInterface(fn=get_spaces_response,
14
+ inputs="text",
15
+ outputs="text",
16
+ title="Hugging Face Spaces Chat",
17
+ description="Chat with a Hugging Face Spaces model",
18
+ placeholder="Type your message here..."
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ chatbot.launch()