vilsonrodrigues commited on
Commit
15d5359
·
1 Parent(s): fe42288

add: tab with to chat mode

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -20,6 +20,10 @@ Follow this steps to use 😉:
20
 
21
  qa = YoutubeQA()
22
 
 
 
 
 
23
  def set_openai_key(key: str):
24
  os.environ["OPENAI_API_KEY"] = key
25
  # Set status field to Not Ready
@@ -56,6 +60,14 @@ with gr.Blocks() as app:
56
  key = gr.Textbox(label="🔑 Key:", type="password", placeholder="Set your OpenAI Key here...")
57
  key_button = gr.Button("Set Key")
58
 
 
 
 
 
 
 
 
 
59
  #with gr.Accordion("Click me. About this App"):
60
  # gr.Markdown("Look at me...")
61
 
 
20
 
21
  qa = YoutubeQA()
22
 
23
+ def change_chat_mode(radio: str):
24
+ if radio == "conversational":
25
+ qa.change_chat_mode(radio)
26
+
27
  def set_openai_key(key: str):
28
  os.environ["OPENAI_API_KEY"] = key
29
  # Set status field to Not Ready
 
60
  key = gr.Textbox(label="🔑 Key:", type="password", placeholder="Set your OpenAI Key here...")
61
  key_button = gr.Button("Set Key")
62
 
63
+ with gr.Tab("Chat Mode (optional)"):
64
+ radio = gr.Radio(
65
+ ["normal", "conversational"],
66
+ label="If conversational, history is kept in prompt",
67
+ value="normal"
68
+ )
69
+ radio.change(fn=change_chat_mode, inputs=radio, outputs=None)
70
+
71
  #with gr.Accordion("Click me. About this App"):
72
  # gr.Markdown("Look at me...")
73