Bayhaqy commited on
Commit
422b355
·
1 Parent(s): 66bfc3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -10,12 +10,8 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
10
  USER_NAME = os.environ.get("USER_NAME", None)
11
  APP_PASSWORD = os.environ.get("APP_PASSWORD", None)
12
 
13
- def get_API(API_URL):
14
- client = InferenceClient(
15
- API_URL,
16
- headers={"Authorization": f"Bearer {HF_TOKEN}"},
17
- )
18
- return client
19
 
20
  def get_BOT(BOT_NAME):
21
  return BOT_NAME
@@ -127,16 +123,18 @@ with gr.Blocks() as demo:
127
  with gr.Column():
128
  gr.Markdown(
129
  """
130
- # GuruAI
 
131
  This is AI as Teacher, It will teach you about anything.
 
132
  ⚠️ **Limitations**: the model can and will produce factually incorrect information, hallucinating facts and actions. As it has not undergone any advanced tuning/alignment, it can produce problematic outputs, especially if prompted to do so. Finally, this demo is limited to a session length of about 1,000 words.
133
 
134
  Example:
135
- API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-180B-chat" BOT_NAME = "Falcon"
136
  """
137
  )
138
 
139
- input_API = gr.Interface(fn=get_API, inputs="text", outputs="text")
140
  input_BOT = gr.Interface(fn=get_BOT, inputs="text", outputs="text")
141
 
142
  gr.ChatInterface(
@@ -145,4 +143,7 @@ with gr.Blocks() as demo:
145
  additional_inputs=additional_inputs,
146
  )
147
 
 
 
 
148
  demo.queue(concurrency_count=100, api_open=True).launch(show_api=True, auth=(USER_NAME, APP_PASSWORD))
 
10
  USER_NAME = os.environ.get("USER_NAME", None)
11
  APP_PASSWORD = os.environ.get("APP_PASSWORD", None)
12
 
13
+ def get_Model(ModelName):
14
+ return ModelName
 
 
 
 
15
 
16
  def get_BOT(BOT_NAME):
17
  return BOT_NAME
 
123
  with gr.Column():
124
  gr.Markdown(
125
  """
126
+ # GuruAI
127
+
128
  This is AI as Teacher, It will teach you about anything.
129
+
130
  ⚠️ **Limitations**: the model can and will produce factually incorrect information, hallucinating facts and actions. As it has not undergone any advanced tuning/alignment, it can produce problematic outputs, especially if prompted to do so. Finally, this demo is limited to a session length of about 1,000 words.
131
 
132
  Example:
133
+ API_URL = "tiiuae/falcon-180B-chat" BOT_NAME = "Falcon"
134
  """
135
  )
136
 
137
+ input_Model = gr.Interface(fn=get_Model, inputs="text", outputs="text")
138
  input_BOT = gr.Interface(fn=get_BOT, inputs="text", outputs="text")
139
 
140
  gr.ChatInterface(
 
143
  additional_inputs=additional_inputs,
144
  )
145
 
146
+ Models = ('https://api-inference.huggingface.co/models/'+ ModelName)
147
+ client = InferenceClient(Models,headers={"Authorization": f"Bearer {HF_TOKEN}"},)
148
+
149
  demo.queue(concurrency_count=100, api_open=True).launch(show_api=True, auth=(USER_NAME, APP_PASSWORD))