File size: 440 Bytes
979ad48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from gradio_client import Client

# Use the existing Hugging Face Space as the backend
client = Client("saadkhi/SQL_chatbot_API")


def chat(prompt: str) -> str:
    """Proxy the prompt to the remote Space /chat endpoint."""
    return client.predict(
        prompt=prompt,
        api_name="/chat",
    )


if __name__ == "__main__":
    # Simple CLI test
    user_prompt = input("Enter your SQL question: ")
    print(chat(user_prompt))