sambanova / app.py
nisten's picture
Update app.py
b132285 verified
import gradio as gr
import sambanova_gradio
gr.load("Qwen2.5-Coder-32B-Instruct", src=sambanova_gradio.registry).launch()
# import os
# import gradio as gr
# import openai
# # Set up the OpenAI client with the Sambanova API
# client = openai.OpenAI(
# api_key=os.environ.get("SAMBANOVA_API_KEY"),
# base_url="https://api.sambanova.ai/v1",
# )
# def generate_text(prompt):
# response = client.chat.completions.create(
# model='Qwen2.5-Coder-32B-Instruct',
# messages=[
# {"role": "system", "content": "You are a helpful assistant"},
# {"role": "user", "content": prompt}
# ],
# temperature=0,
# max_tokens=8192
# )
# return response.choices[0].message.content
# # Create the Gradio interface
# iface = gr.Interface(
# fn=generate_text,
# inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
# outputs="text",
# title="Qwen2.5-Coder-32B-Instruct Chatbot",
# description="Enter a prompt and get a response from the Qwen2.5-Coder-32B-Instruct model."
# )
# # Launch the interface
# iface.launch()