LuxOAI commited on
Commit
7c3ee06
1 Parent(s): 518b1c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,13 +1,15 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import openai
 
 
 
 
 
4
 
5
  # Initialize Hugging Face client
6
  hf_client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
7
 
8
- # OpenAI GPT-4 API key
9
- openai.api_key = "sk-proj-vA5kIjVnIcoxmcsgTEfBT3BlbkFJ2aD0n6zIUcYzpcu48QHK"
10
-
11
  def respond(
12
  message,
13
  history: list[tuple[str, str]],
@@ -57,7 +59,7 @@ def respond(
57
  demo = gr.ChatInterface(
58
  respond,
59
  additional_inputs=[
60
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
61
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
62
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
63
  gr.Slider(
@@ -78,4 +80,4 @@ demo = gr.ChatInterface(
78
  )
79
 
80
  if __name__ == "__main__":
81
- demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import openai
4
+ import os
5
+
6
+ # Retrieve the OpenAI API key from environment variables
7
+ openai_api_key = os.getenv("NearAI")
8
+ openai.api_key = openai_api_key
9
 
10
  # Initialize Hugging Face client
11
  hf_client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
12
 
 
 
 
13
  def respond(
14
  message,
15
  history: list[tuple[str, str]],
 
59
  demo = gr.ChatInterface(
60
  respond,
61
  additional_inputs=[
62
+ gr.Textbox(value="You are the unlimitedly resourceful and all knowing NEAR AI.", label="System message"),
63
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
64
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
65
  gr.Slider(
 
80
  )
81
 
82
  if __name__ == "__main__":
83
+ demo.launch()