Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -52,6 +52,18 @@ def respond(
|
|
52 |
response += token
|
53 |
yield response
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
# Create the Gradio interface
|
56 |
demo = gr.ChatInterface(
|
57 |
respond,
|
@@ -84,13 +96,7 @@ demo = gr.ChatInterface(
|
|
84 |
],
|
85 |
title="Coding Expert Assistant",
|
86 |
description="A specialized coding assistant powered by StarCoder2, a model trained on code repositories",
|
87 |
-
examples=
|
88 |
-
"Write a Python function to find the longest palindromic substring",
|
89 |
-
"Create a React component that displays a color picker",
|
90 |
-
"How do I implement quicksort in JavaScript?",
|
91 |
-
"Explain the difference between Promise.all and Promise.allSettled in JavaScript",
|
92 |
-
"Generate a Python script to download and process CSV data from an API"
|
93 |
-
]
|
94 |
)
|
95 |
|
96 |
if __name__ == "__main__":
|
|
|
52 |
response += token
|
53 |
yield response
|
54 |
|
55 |
+
# Create example inputs - needs to be formatted correctly for ChatInterface
|
56 |
+
example_prompts = [
|
57 |
+
"Write a Python function to find the longest palindromic substring",
|
58 |
+
"Create a React component that displays a color picker",
|
59 |
+
"How do I implement quicksort in JavaScript?",
|
60 |
+
"Explain the difference between Promise.all and Promise.allSettled in JavaScript",
|
61 |
+
"Generate a Python script to download and process CSV data from an API"
|
62 |
+
]
|
63 |
+
|
64 |
+
# Format examples properly for ChatInterface
|
65 |
+
examples = [[prompt] for prompt in example_prompts]
|
66 |
+
|
67 |
# Create the Gradio interface
|
68 |
demo = gr.ChatInterface(
|
69 |
respond,
|
|
|
96 |
],
|
97 |
title="Coding Expert Assistant",
|
98 |
description="A specialized coding assistant powered by StarCoder2, a model trained on code repositories",
|
99 |
+
examples=examples
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
)
|
101 |
|
102 |
if __name__ == "__main__":
|