jh000107 commited on
Commit
5cf1f63
·
1 Parent(s): 2859b9d
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
  import openai
3
  from openai import OpenAI
4
- from dotenv import load_dotenv
5
 
6
  import re
7
  import matplotlib.pyplot as plt
@@ -187,7 +187,9 @@ def get_completion(conversation, model="gpt-4-1106-preview"):
187
 
188
  [{sample_output}]
189
  """
190
- load_dotenv()
 
 
191
  openai_api_key = os.getenv('OPENAI_API_KEY')
192
 
193
  if openai_api_key is None:
@@ -298,9 +300,10 @@ def get_completion(conversation, model="gpt-4-1106-preview"):
298
 
299
  return fig
300
 
301
- fig = sentiment_flow_plot(analysis)
302
 
303
- return response.choices[0].message.content, fig
 
304
 
305
  import gradio as gr
306
 
@@ -317,6 +320,6 @@ with gr.Blocks() as gpt_analysis:
317
  output_box = gr.Textbox(value="", label="Output",lines=4)
318
  plot_box = gr.Plot(label="Analysis Plot")
319
 
320
- btn.click(get_completion, inputs=conversation, outputs=[output_box, plot_box])
321
 
322
  gr.TabbedInterface([gpt_analysis], ["GPT Analysis"]).launch(inline=False, debug=True)
 
1
  import os
2
  import openai
3
  from openai import OpenAI
4
+ from dotenv import load_dotenv, find_dotenv
5
 
6
  import re
7
  import matplotlib.pyplot as plt
 
187
 
188
  [{sample_output}]
189
  """
190
+
191
+ # load_dotenv(find_dotenv("_.env"), override=True)
192
+
193
  openai_api_key = os.getenv('OPENAI_API_KEY')
194
 
195
  if openai_api_key is None:
 
300
 
301
  return fig
302
 
303
+ # fig = sentiment_flow_plot(analysis)
304
 
305
+ # return response.choices[0].message.content, fig
306
+ return openai_api_key
307
 
308
  import gradio as gr
309
 
 
320
  output_box = gr.Textbox(value="", label="Output",lines=4)
321
  plot_box = gr.Plot(label="Analysis Plot")
322
 
323
+ btn.click(get_completion, inputs=conversation, outputs=[output_box])
324
 
325
  gr.TabbedInterface([gpt_analysis], ["GPT Analysis"]).launch(inline=False, debug=True)