| import streamlit as st |
| import requests |
|
|
| |
| API_URL = "https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" |
|
|
| |
| def query(payload): |
| headers = {"Authorization": f"Bearer {st.secrets['HF_TOKEN']}"} |
| response = requests.post(API_URL, headers=headers, json=payload) |
| return response.json() |
|
|
| |
| st.title("DeepSeek-R1-Distill-Qwen-32B Chatbot") |
|
|
| |
| user_input = st.text_input("Enter your message:") |
|
|
| if user_input: |
| |
| payload = {"inputs": user_input} |
| output = query(payload) |
| |
| |
| if isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]: |
| st.write("Response:") |
| st.write(output[0]['generated_text']) |
| else: |
| st.write("Error: Unable to generate a response. Please try again.") |