Spaces:
Runtime error
Runtime error
TechWithAnirudh
commited on
Commit
·
0fb03dd
1
Parent(s):
6fcb283
Update app.py
Browse files
app.py
CHANGED
@@ -69,21 +69,6 @@ def initialize_prompt(prompt_type, history):
|
|
69 |
return history, history
|
70 |
|
71 |
|
72 |
-
def display_prompt(show, prompt_type):
|
73 |
-
if not prompt_type:
|
74 |
-
show = False
|
75 |
-
return "Error - prompt not selected"
|
76 |
-
|
77 |
-
else:
|
78 |
-
if show:
|
79 |
-
prompt_file = "./prompts/" + str(prompt_type) + ".txt"
|
80 |
-
|
81 |
-
with open(prompt_file, "r") as f:
|
82 |
-
prompt = f.read()
|
83 |
-
|
84 |
-
return prompt
|
85 |
-
else:
|
86 |
-
return ""
|
87 |
|
88 |
|
89 |
with gr.Blocks() as demo:
|
@@ -106,18 +91,6 @@ with gr.Blocks() as demo:
|
|
106 |
l = os.listdir("./prompts")
|
107 |
li = [x.split(".")[0] for x in l]
|
108 |
|
109 |
-
gr.Markdown("""<h4>Initial Prompt for ChatGPT</h4>""")
|
110 |
-
prompt_type = gr.components.Dropdown(
|
111 |
-
li,
|
112 |
-
label="Select sample prompt",
|
113 |
-
value=None,
|
114 |
-
info="Choose a prompt based on the robot/scenario you're interested in (e.g. pick airsim or real_drone to start a drone scenario)",
|
115 |
-
)
|
116 |
-
|
117 |
-
show_prompt = gr.Checkbox(label="Display prompt")
|
118 |
-
prompt_display = gr.Textbox(interactive=False, label="Prompt")
|
119 |
-
show_prompt.change(fn=display_prompt, inputs=[show_prompt, prompt_type], outputs=prompt_display)
|
120 |
-
|
121 |
initialize = gr.Button(value="Initialize")
|
122 |
|
123 |
gr.Markdown("""<h4>Conversation</h4>""")
|
|
|
69 |
return history, history
|
70 |
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
|
74 |
with gr.Blocks() as demo:
|
|
|
91 |
l = os.listdir("./prompts")
|
92 |
li = [x.split(".")[0] for x in l]
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
initialize = gr.Button(value="Initialize")
|
95 |
|
96 |
gr.Markdown("""<h4>Conversation</h4>""")
|