Omar Solano commited on
Commit
9e20f4b
1 Parent(s): 0ebb816

add duplicate button

Browse files
Files changed (1) hide show
  1. gradio_anthropic.py +11 -4
gradio_anthropic.py CHANGED
@@ -14,9 +14,8 @@ logging.getLogger("httpx").setLevel(logging.WARNING)
14
 
15
 
16
  def generate_completion(
17
- input, history, api_key, model, system_prompt, temperature, max_tokens
18
  ):
19
-
20
  if os.getenv("ANTHROPIC_API_KEY"):
21
  api_key = os.getenv("ANTHROPIC_API_KEY")
22
 
@@ -75,12 +74,20 @@ system_prompt = gr.Textbox(
75
  )
76
  temperature = gr.Slider(label="Temperature", value=0.0, minimum=0.0, maximum=1.0)
77
  max_tokens = gr.Slider(label="Max Tokens", value=4096, minimum=1, maximum=4096)
 
78
 
79
 
80
  demo = gr.ChatInterface(
81
  fn=generate_completion,
82
- additional_inputs=[api_key, model, system_prompt, temperature, max_tokens],
83
- description="Claude Chatbot, add your own API key in the 'additional inputs' section",
 
 
 
 
 
 
 
84
  )
85
 
86
  if __name__ == "__main__":
 
14
 
15
 
16
  def generate_completion(
17
+ duplicate, input, history, api_key, model, system_prompt, temperature, max_tokens
18
  ):
 
19
  if os.getenv("ANTHROPIC_API_KEY"):
20
  api_key = os.getenv("ANTHROPIC_API_KEY")
21
 
 
74
  )
75
  temperature = gr.Slider(label="Temperature", value=0.0, minimum=0.0, maximum=1.0)
76
  max_tokens = gr.Slider(label="Max Tokens", value=4096, minimum=1, maximum=4096)
77
+ duplicate = gr.DuplicateButton(variant="primary")
78
 
79
 
80
  demo = gr.ChatInterface(
81
  fn=generate_completion,
82
+ additional_inputs=[
83
+ duplicate,
84
+ api_key,
85
+ model,
86
+ system_prompt,
87
+ temperature,
88
+ max_tokens,
89
+ ],
90
+ description="Claude Chatbot, Duplicate space and add your own API key in the 'additional inputs' section",
91
  )
92
 
93
  if __name__ == "__main__":