import streamlit as st import requests # Set up the API endpoint and headers API_URL = "https://api-inference.huggingface.co/models/tencent/Tencent-Hunyuan-Large" HF_API_KEY = st.secrets["HF_API_KEY"] # Load the API key from secrets def query(payload): headers = {"Authorization": f"Bearer {HF_API_KEY}"} response = requests.post(API_URL, headers=headers, json=payload) return response.json() # Create a text input field for the user st.title("Tencent-Hunyuan-Large Model Demo") user_input = st.text_input("Enter your text:", "") # Create a button to trigger the API request if st.button("Query Model"): # Prepare the payload and send the request payload = {"inputs": user_input} response = query(payload) st.write(response)