Spaces:
Runtime error
Runtime error
import random | |
import gradio as gr | |
import bardapi | |
# Set your Secure-1PSID value to token | |
token = 'cQjDrFOQjkhOHHHCW54Tc7IKyphnqos-A-IpmgjVa9p3_ZFFa5Ilet-heMO8Xm3TM1Y5vw.' | |
def get_spaces_response(message, history): | |
# Send an API request and get a response | |
response = bardapi.core.Bard(token).get_answer(message) | |
return response["answers"][0]["answer"] | |
chatbot = gr.ChatInterface(fn=get_spaces_response, | |
inputs="text", | |
outputs="text", | |
title="Hugging Face Spaces Chat", | |
description="Chat with a Hugging Face Spaces model", | |
placeholder="Type your message here..." | |
) | |
if __name__ == "__main__": | |
chatbot.launch() |