Spaces:
Sleeping
Sleeping
File size: 1,155 Bytes
0fb54f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from openai import OpenAI
import os
client = OpenAI(api_key=os.environ['DEEPSEEK_API'], base_url="https://api.deepseek.com/v1")
def code_completion(input_data, metadata):
print(f"Input data type: {type(input_data)}") # Debugging line
print(f"Input data content: {input_data}") # Debugging line
prompt = input_data # Use the string directly as the prompt
response = client.chat.completions.create(
model="deepseek-coder",
messages=[
{"role": "system", "content": "You are an Advance AI coding Assistant called Jarvis."},
{"role": "user", "content": prompt},
]
)
return response.choices[0].message.content
dark_minimalist = gr.Theme.from_hub("Taithrah/Minimal")
iface=gr.ChatInterface(theme=dark_minimalist,
fn=code_completion,
chatbot=gr.Chatbot(show_label=False,container=True, show_share_button=False, show_copy_button=True, likeable=True, layout="bubble"),
concurrency_limit=20,retry_btn="Retry",
undo_btn=None,clear_btn="Clear Chats",
css="""
footer {
visibility: hidden;
}
"""
)
iface.launch(show_api=False)
|