Spaces:
Sleeping
Sleeping
| 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) | |