orangecode12 commited on
Commit
cd560f6
·
verified ·
1 Parent(s): c2efe09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -5,7 +5,11 @@ import requests
5
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
6
  PLAYGROUND_TOKEN = os.getenv("PLAYGROUND_TOKEN", "changeme")
7
 
8
- def call_gpt(master_prompt, checklist, transcript):
 
 
 
 
9
  # Combine inputs dynamically
10
  full_prompt = f"""{master_prompt}
11
 
@@ -33,6 +37,7 @@ Transcript:
33
  # Gradio UI
34
  with gr.Blocks() as demo:
35
  gr.Markdown("# GPT Playground")
 
36
  check_list_box = gr.Textbox(lines=5, label="Checklist")
37
  transcript_box = gr.Textbox(lines=5, label="Transcript")
38
  master_prompt_box = gr.Textbox(
@@ -48,13 +53,13 @@ Use one of informative emojis at the beginnind of each bullet:
48
  ❌ Criteria is not met"""
49
  )
50
 
51
- output_box = gr.Textbox(lines=10, label="GPT Reply")
52
  submit = gr.Button("Send")
53
 
54
  # Pass the *components*, not strings
55
  submit.click(
56
  fn=call_gpt,
57
- inputs=[master_prompt_box, check_list_box, transcript_box],
58
  outputs=output_box,
59
  )
60
 
 
5
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
6
  PLAYGROUND_TOKEN = os.getenv("PLAYGROUND_TOKEN", "changeme")
7
 
8
+ def call_gpt(token_box, master_prompt, checklist, transcript):
9
+ # Simple auth check
10
+ if token != PLAYGROUND_TOKEN:
11
+ return "❌ Unauthorized. Wrong token."
12
+
13
  # Combine inputs dynamically
14
  full_prompt = f"""{master_prompt}
15
 
 
37
  # Gradio UI
38
  with gr.Blocks() as demo:
39
  gr.Markdown("# GPT Playground")
40
+ token_box = gr.Textbox(lines=1, label="Token")
41
  check_list_box = gr.Textbox(lines=5, label="Checklist")
42
  transcript_box = gr.Textbox(lines=5, label="Transcript")
43
  master_prompt_box = gr.Textbox(
 
53
  ❌ Criteria is not met"""
54
  )
55
 
56
+ output_box = gr.Textbox(lines=10, label="Report")
57
  submit = gr.Button("Send")
58
 
59
  # Pass the *components*, not strings
60
  submit.click(
61
  fn=call_gpt,
62
+ inputs=[token_box, master_prompt_box, check_list_box, transcript_box],
63
  outputs=output_box,
64
  )
65