johnhelf commited on
Commit
9c2a562
·
1 Parent(s): b2c5a10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -13
app.py CHANGED
@@ -32,17 +32,30 @@ def codeinterpreter(openai_key,prompt, files):
32
  return [response.content,images]
33
 
34
 
35
- inp1=gr.Textbox(label="openai_key")
36
- inp2=gr.Textbox(label="prompt",info="input the prompt")
37
- inp3=gr.Files()
38
-
39
- app = gr.Interface(
40
- fn=codeinterpreter,
41
- inputs=[inp1,inp2,inp3],
42
- outputs=["text","gallery"],
43
- examples=[["","Plot the nvidea stock vs microsoft stock over the last 6 months.",None],
44
- ["","Plot a sin wave and show it to me.",None],
45
- ["","怡亚通最近半年走势",None],
46
- ["","Plot the bitcoin chart of 2023 YTD",None]]
47
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  app.launch()
 
32
  return [response.content,images]
33
 
34
 
35
+ with gr.Blocks() as app:
36
+ with gr.Row():
37
+ with gr.Column():
38
+ inp1=gr.Textbox(label="openai_key")
39
+ inp2=gr.Textbox(label="prompt",info="input the prompt")
40
+ inp3=gr.Files()
41
+ with gr.Column():
42
+ out1=gr.Textbox(label="result")
43
+ out2=gr.Gallery()
44
+ gr.Examples([["Plot the nvidea stock vs microsoft stock over the last 6 months."],
45
+ ["Plot a sin wave and show it to me."],
46
+ ["贵州茅台最近半年走势"],
47
+ [Plot the bitcoin chart of 2023 YTD"]],
48
+ [inp2])
49
+ btn = gr.Button(value="Mirror Image")
50
+ btn.click(codeinterpreter, inputs=[inp1,inp2,inp3], outputs=[out1,out2])
51
+
52
+ # app = gr.Interface(
53
+ # fn=codeinterpreter,
54
+ # inputs=[inp1,inp2,inp3],
55
+ # outputs=["text","gallery"],
56
+ # examples=[["","Plot the nvidea stock vs microsoft stock over the last 6 months.",None],
57
+ # ["","Plot a sin wave and show it to me.",None],
58
+ # ["","怡亚通最近半年走势",None],
59
+ # ["","Plot the bitcoin chart of 2023 YTD",None]]
60
+ # )
61
  app.launch()