Ari commited on
Commit
f1bfa64
·
1 Parent(s): 999698d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -8,6 +8,12 @@ data = pd.read_csv("RR.csv")
8
  # Set your OpenAI API key
9
  openai.api_key = "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"
10
 
 
 
 
 
 
 
11
  def query_gpt(prompt):
12
  model_engine = "text-davinci-002" # Use any available GPT model here
13
  max_tokens = 50
@@ -26,12 +32,12 @@ def query_gpt(prompt):
26
 
27
 
28
  def get_insights(question):
29
- prompt = f"Using ONLY the information in the following dataset:\n\n{data.to_string(index=False)}\n\nPlease answer the question: {question}\n\nRemember, base your answer solely on the data provided in the dataset."
30
  answer = query_gpt(prompt)
31
  return answer
32
 
33
 
34
- markdown_data = f"Mock Dataset Sales & Marketing Budget :\n```\n{data.head(10).to_string(index=False)}\n```\n"
35
 
36
  iface = gr.Interface(
37
  fn=get_insights,
@@ -50,8 +56,14 @@ iface = gr.Interface(
50
  allow_screenshot=False,
51
  theme="compact",
52
  layout="vertical",
 
 
 
 
 
 
 
 
53
  )
54
 
55
-
56
-
57
- iface.launch(inbrowser=True)
 
8
  # Set your OpenAI API key
9
  openai.api_key = "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"
10
 
11
+ # Create four graphs using plotly express
12
+ graph1 = px.line(data, x="Month", y="Sales Forecast")
13
+ graph2 = px.line(data, x="Month", y="Sales Actual")
14
+ graph3 = px.line(data, x="Month", y="Marketing Budget")
15
+ graph4 = px.line(data, x="Month", y="Support Chats and Calls")
16
+
17
  def query_gpt(prompt):
18
  model_engine = "text-davinci-002" # Use any available GPT model here
19
  max_tokens = 50
 
32
 
33
 
34
  def get_insights(question):
35
+ prompt = f"Please answer the question: {question}\n\nRemember, base your answer solely on the data provided in the dataset."
36
  answer = query_gpt(prompt)
37
  return answer
38
 
39
 
40
+ markdown_data = "Mock Dataset Sales & Marketing Budget"
41
 
42
  iface = gr.Interface(
43
  fn=get_insights,
 
56
  allow_screenshot=False,
57
  theme="compact",
58
  layout="vertical",
59
+ article="",
60
+ # Add four plot outputs
61
+ outputs=[
62
+ gr.outputs.Plot(plot=graph1),
63
+ gr.outputs.Plot(plot=graph2),
64
+ gr.outputs.Plot(plot=graph3),
65
+ gr.outputs.Plot(plot=graph4),
66
+ ],
67
  )
68
 
69
+ iface.launch(inbrowser=True)