brunhild217 commited on
Commit
c624f0d
·
1 Parent(s): f48f015

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -43,6 +43,10 @@ def get_instructor_prompt(fileobj):
43
  instructor_prompt = f.read()
44
  return str(instructor_prompt)
45
 
 
 
 
 
46
 
47
  with gr.Blocks() as demo:
48
  #initialize tutor (with state)
@@ -97,8 +101,9 @@ with gr.Blocks() as demo:
97
  file_input = gr.File(label="Load a .txt or .py file",
98
  file_types=['.py', '.txt'], type="file",
99
  elem_classes="short-height")
100
- instructor_prompt = os.environ.get("OPENAI_API_KEY")
101
  gr.Interface(get_instructor_prompt, file_input, instructor_prompt)
102
- gr.Textbox(os.environ.get("OPENAI_API_KEY"))
 
103
 
104
  demo.queue().launch(server_name='0.0.0.0', server_port=7860)
 
43
  instructor_prompt = f.read()
44
  return str(instructor_prompt)
45
 
46
+ def embed_prompt(chat_tutor, instructor_prompt):
47
+ instructor_prompt = instructor_prompt.value
48
+ os.environ["SECRET_PROMPT"] = instructor_prompt
49
+ return os.environ.get("SECRET_PROMPT")
50
 
51
  with gr.Blocks() as demo:
52
  #initialize tutor (with state)
 
101
  file_input = gr.File(label="Load a .txt or .py file",
102
  file_types=['.py', '.txt'], type="file",
103
  elem_classes="short-height")
104
+ instructor_prompt = gr.Textbox(visible=False)
105
  gr.Interface(get_instructor_prompt, file_input, instructor_prompt)
106
+ instructor_prompt.change(embed_prompt, instructor_prompt, test)
107
+ test = gr.Textbox(label="testing")
108
 
109
  demo.queue().launch(server_name='0.0.0.0', server_port=7860)