Spaces:
Sleeping
Sleeping
SMeyersMrOvkill
commited on
Commit
·
a5c4680
1
Parent(s):
9cf6b89
reddy
Browse files
app.py
CHANGED
@@ -1,65 +1,28 @@
|
|
1 |
import gradio as gr
|
2 |
-
from llama_cpp import Llama
|
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 |
-
for message in llm.create_chat_completion(
|
32 |
-
messages,
|
33 |
-
max_tokens=max_tokens,
|
34 |
-
stream=True,
|
35 |
-
temperature=temperature,
|
36 |
-
top_p=top_p,
|
37 |
-
top_k=42,
|
38 |
-
):
|
39 |
-
token = message.choices[0].delta.content
|
40 |
-
|
41 |
-
response += token
|
42 |
-
yield response
|
43 |
-
|
44 |
-
"""
|
45 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
46 |
-
"""
|
47 |
-
demo = gr.ChatInterface(
|
48 |
-
respond,
|
49 |
-
additional_inputs=[
|
50 |
-
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
51 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
52 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
53 |
-
gr.Slider(
|
54 |
-
minimum=0.1,
|
55 |
-
maximum=1.0,
|
56 |
-
value=0.95,
|
57 |
-
step=0.05,
|
58 |
-
label="Top-p (nucleus sampling)",
|
59 |
-
),
|
60 |
-
],
|
61 |
-
)
|
62 |
-
|
63 |
-
|
64 |
-
if __name__ == "__main__":
|
65 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
+
def code_block(code):
|
4 |
+
# Add your code logic here
|
5 |
+
# This function will be called when the submit button is clicked
|
6 |
+
pass
|
7 |
+
|
8 |
+
code_input = gr.inputs.Code(label="Enter your code here")
|
9 |
+
submit_button = gr.outputs.Button(label="Submit")
|
10 |
+
|
11 |
+
options = [
|
12 |
+
gr.outputs.Accordion([
|
13 |
+
gr.outputs.Checkbox(label="Option 1"),
|
14 |
+
gr.outputs.Checkbox(label="Option 2"),
|
15 |
+
gr.outputs.Checkbox(label="Option 3")
|
16 |
+
], label="Options")
|
17 |
+
]
|
18 |
+
# COnvert this to gr.Blocks()
|
19 |
+
|
20 |
+
with gr.Blocks() as apps:
|
21 |
+
with gr.Row():
|
22 |
+
mdn = gr.Markdown("## StarCoder 15b Instruct\n\n---\n\n")
|
23 |
+
with gr.Row():
|
24 |
+
code = gr.Code("// Enter some Javascript here to interact with StarCoder.\n\nconsole.log(\"StarCoder says")
|
25 |
+
with gr.Row():
|
26 |
+
btn = gr.Button("Complete with StarCoder")
|
27 |
+
btn.click(code_block, inputs=[code, mdn], outputs=[code, mdn])
|
28 |
+
apps.launch(share=False, debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|