Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -170,26 +170,17 @@ def respond(message, history, max_tokens):
|
|
170 |
for response in generate_pseudocode(message, max_tokens):
|
171 |
yield response
|
172 |
|
173 |
-
# Gradio
|
174 |
-
|
175 |
-
|
176 |
-
gr.
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
label="Generated Pseudocode",
|
185 |
-
lines=5
|
186 |
-
)
|
187 |
-
|
188 |
-
submit_btn.click(
|
189 |
-
fn=respond,
|
190 |
-
inputs=[cpp_input, gr.State(value=[]), gr.Slider(minimum=10, maximum=1000, value=50, step=1, visible=False)],
|
191 |
-
outputs=pseudocode_output
|
192 |
-
)
|
193 |
|
194 |
if __name__ == "__main__":
|
195 |
demo.launch()
|
|
|
170 |
for response in generate_pseudocode(message, max_tokens):
|
171 |
yield response
|
172 |
|
173 |
+
# Gradio interface
|
174 |
+
demo = gr.ChatInterface(
|
175 |
+
respond,
|
176 |
+
chatbot=gr.Chatbot(label="C++ to Pseudocode Generator"),
|
177 |
+
textbox=gr.Textbox(placeholder="Enter C++ code (e.g., 'int x = 5; for(int i=0; i<x; i++) cout << i;')", label="C++ Code"),
|
178 |
+
additional_inputs=[
|
179 |
+
gr.Slider(minimum=10, maximum=1000, value=50, step=1, label="Max tokens"),
|
180 |
+
],
|
181 |
+
title="C++ to Pseudocode Transformer",
|
182 |
+
description="Convert C++ code to pseudocode using a custom transformer trained on the SPoC dataset.",
|
183 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
if __name__ == "__main__":
|
186 |
demo.launch()
|