Kvikontent commited on
Commit
02fae49
·
1 Parent(s): 89eae80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -16
app.py CHANGED
@@ -1,22 +1,19 @@
1
  import gradio as gr
2
  import bardapi
3
 
4
- # Set your token
5
- token = 'xxxxxxx'
6
 
7
- def get_spaces_response(message):
8
- # Send an API request and get a response
9
- response = bardapi.core.Bard(token).get_answer(message)
10
- return response["answers"][0]["answer"]
11
 
12
- chatbot = gr.Interface(
13
- 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
- layout="vertical",
19
- )
20
 
21
- if __name__ == "__main__":
22
- chatbot.launch()
 
1
  import gradio as gr
2
  import bardapi
3
 
4
+ # Set your Secure-1PSID value to key
5
+ token = 'cQjDrFOQjkhOHHHCW54Tc7IKyphnqos-A-IpmgjVa9p3_ZFFa5Ilet-heMO8Xm3TM1Y5vw'
6
 
7
+ def get_answer(input_text):
8
+ # Send an API request and get a response.
9
+ response = bardapi.core.Bard(token).get_answer(input_text)
10
+ return response
11
 
12
+ # Create a Gradio interface
13
+ iface = gr.Interface(
14
+ fn=get_answer,
15
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your input text"),
16
+ outputs="text")
 
 
 
17
 
18
+ # Run the interface
19
+ iface.launch()