Ramesh-vani commited on
Commit
c7228ae
1 Parent(s): face11b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -18
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio
2
  import subprocess
3
- from gradio.mix import Parallel,Series
4
 
5
  def run_command(command):
6
  process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -153,28 +153,45 @@ def run_code(command):
153
 
154
  return result
155
 
156
- gradio_interface1 = gradio.Interface(
157
- fn=run_code,
158
- inputs="text",
159
- outputs="text",
160
 
161
- title="REST API ",
162
- description="This is an AI powered languages API ",
163
- article=""
164
- )
165
 
166
- gradio_interface2 = gradio.Interface(
167
- fn=run_command,
168
- inputs="text",
169
- outputs="text",
170
 
171
- title="REST API ",
172
- description="This is an AI powered command REST API ",
173
- article=""
174
- )
175
  # gradio_interface1.launch()
176
  # gradio_interface2.launch()
177
- Parallel(gradio_interface1,gradio_interface2).launch()
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
 
 
180
 
 
1
  import gradio
2
  import subprocess
3
+
4
 
5
  def run_command(command):
6
  process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 
153
 
154
  return result
155
 
156
+ # gradio_interface1 = gradio.Interface(
157
+ # fn=run_code,
158
+ # inputs="text",
159
+ # outputs="text",
160
 
161
+ # title="REST API ",
162
+ # description="This is an AI powered languages API ",
163
+ # article=""
164
+ # )
165
 
166
+ # gradio_interface2 = gradio.Interface(
167
+ # fn=run_command,
168
+ # inputs="text",
169
+ # outputs="text",
170
 
171
+ # title="REST API ",
172
+ # description="This is an AI powered command REST API ",
173
+ # article=""
174
+ # )
175
  # gradio_interface1.launch()
176
  # gradio_interface2.launch()
 
177
 
178
+
179
+ with gradio.Blocks() as demo:
180
+ gradio.Markdown("run command or run code.")
181
+ with gradio.Tab("run command"):
182
+ command_input = gradio.Textbox()
183
+ command_output = gradio.Textbox()
184
+ command_button = gradio.Button("submit command")
185
+ with gradio.Tab("run code"):
186
+ with gradio.Row():
187
+ code_input = gradio.Textbox()
188
+ code_output = gradio.Textbox()
189
+ code_button = gradio.Button("submit code@lanuage)
190
+
191
+
192
+ command_button.click(run_command, inputs=command_input, outputs=command_output)
193
+ code_button.click(run_code, inputs=code_input, outputs=code_output)
194
 
195
+ if __name__ == "__main__":
196
+ demo.launch()
197