Spaces:
Sleeping
Sleeping
File size: 619 Bytes
c1c4977 24d620f 9e80ceb 24d620f 9e80ceb 54bb289 a3025ba 9e80ceb a2061b4 9e80ceb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import os
import streamlit as st
from huggingface_hub import InferenceClient
api_key = os.getenv("HF_API_KEY")
client = InferenceClient(api_key=api_key)
user_input = st.text_input('Ask me a question')
messages = [{"role": "user","content": user_input}]
completion = client.chat.completions.create(
model="Qwen/Qwen2.5-Coder-32B-Instruct",
messages=messages,
max_tokens=500
)
if st.button("Submit"):
if user_input:
response = completion.choices[0].message
st.write(f"Adrega AI: {response}")
else:
st.write("Please enter a question.")
print(completion.choices[0].message) |