nisten commited on
Commit
b132285
1 Parent(s): 85bd401

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -31
app.py CHANGED
@@ -1,36 +1,36 @@
1
- # import gradio as gr
2
- import sambanova_gradio
3
- # gr.load("Qwen2.5-Coder-32B-Instruct", src=sambanova_gradio.registry).launch()
4
- import os
5
  import gradio as gr
6
- import openai
 
 
 
 
7
 
8
- # Set up the OpenAI client with the Sambanova API
9
- client = openai.OpenAI(
10
- api_key=os.environ.get("SAMBANOVA_API_KEY"),
11
- base_url="https://api.sambanova.ai/v1",
12
- )
13
 
14
- def generate_text(prompt):
15
- response = client.chat.completions.create(
16
- model='Qwen2.5-Coder-32B-Instruct',
17
- messages=[
18
- {"role": "system", "content": "You are a helpful assistant"},
19
- {"role": "user", "content": prompt}
20
- ],
21
- temperature=0,
22
- max_tokens=8192
23
- )
24
- return response.choices[0].message.content
25
 
26
- # Create the Gradio interface
27
- iface = gr.Interface(
28
- fn=generate_text,
29
- inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
30
- outputs="text",
31
- title="Qwen2.5-Coder-32B-Instruct Chatbot",
32
- description="Enter a prompt and get a response from the Qwen2.5-Coder-32B-Instruct model."
33
- )
34
 
35
- # Launch the interface
36
- iface.launch()
 
 
 
 
 
1
  import gradio as gr
2
+ import sambanova_gradio
3
+ gr.load("Qwen2.5-Coder-32B-Instruct", src=sambanova_gradio.registry).launch()
4
+ # import os
5
+ # import gradio as gr
6
+ # import openai
7
 
8
+ # # Set up the OpenAI client with the Sambanova API
9
+ # client = openai.OpenAI(
10
+ # api_key=os.environ.get("SAMBANOVA_API_KEY"),
11
+ # base_url="https://api.sambanova.ai/v1",
12
+ # )
13
 
14
+ # def generate_text(prompt):
15
+ # response = client.chat.completions.create(
16
+ # model='Qwen2.5-Coder-32B-Instruct',
17
+ # messages=[
18
+ # {"role": "system", "content": "You are a helpful assistant"},
19
+ # {"role": "user", "content": prompt}
20
+ # ],
21
+ # temperature=0,
22
+ # max_tokens=8192
23
+ # )
24
+ # return response.choices[0].message.content
25
 
26
+ # # Create the Gradio interface
27
+ # iface = gr.Interface(
28
+ # fn=generate_text,
29
+ # inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
30
+ # outputs="text",
31
+ # title="Qwen2.5-Coder-32B-Instruct Chatbot",
32
+ # description="Enter a prompt and get a response from the Qwen2.5-Coder-32B-Instruct model."
33
+ # )
34
 
35
+ # # Launch the interface
36
+ # iface.launch()