|
import streamlit as st |
|
import requests |
|
import json |
|
|
|
st.title("DeepSeek-R1-Distill-Qwen-32B") |
|
|
|
|
|
API_URL = "https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" |
|
|
|
|
|
|
|
|
|
headers = {} |
|
|
|
def query_hf_api(prompt: str): |
|
""" |
|
Sends a JSON payload to the HF Inference API. |
|
""" |
|
payload = {"inputs": prompt} |
|
response = requests.post(API_URL, headers=headers, data=json.dumps(payload)) |
|
return response.json() |
|
|
|
|
|
user_input = st.text_input("Enter your prompt", value="Hello, how are you?") |
|
|
|
|
|
if st.button("Generate"): |
|
with st.spinner("Generating..."): |
|
result = query_hf_api(user_input) |
|
st.write("**API Response:**") |
|
st.json(result) |
|
|