Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,21 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import spaces
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from spaces import spaces
|
| 3 |
+
|
| 4 |
+
class CodeLlamaUI:
|
| 5 |
+
def __init__(self):
|
| 6 |
+
@spaces.GPU
|
| 7 |
+
def generate_code(prompt):
|
| 8 |
+
# Assuming you have a function to interact with the CodeLlama model
|
| 9 |
+
return code_generation_function(prompt)
|
| 10 |
+
|
| 11 |
+
self.gr = gr.Interface(
|
| 12 |
+
fn=generate_code,
|
| 13 |
+
inputs=gr.Textbox(label="Prompt"),
|
| 14 |
+
outputs=gr.CodeEditor(language="python"),
|
| 15 |
+
title="CodeLlama Code Generation"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
self.gr.launch()
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
ui = CodeLlamaUI()
|