File size: 561 Bytes
47e5e61
a9c2757
398fc8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import spaces

class CodeLlamaUI:
    def __init__(self):
        @spaces.GPU
        def generate_code(prompt):
            # Assuming you have a function to interact with the CodeLlama model
            return code_generation_function(prompt)

        self.gr = gr.Interface(
            fn=generate_code,
            inputs=gr.Textbox(label="Prompt"),
            outputs=gr.CodeEditor(language="python"),
            title="CodeLlama Code Generation"
        )

        self.gr.launch()

if __name__ == "__main__":
    ui = CodeLlamaUI()