a100 kh commited on
Commit
af40ecb
1 Parent(s): 34c2c1b
Files changed (1) hide show
  1. app.py +3 -15
app.py CHANGED
@@ -1,10 +1,9 @@
1
  import gradio as gr
2
  # from huggingface_hub import InferenceClient
3
  from openai import OpenAI
4
-
5
- # Modify OpenAI's API key and API base to use vLLM's API server.
6
- openai_api_key = "12345"
7
- openai_api_base = "https://a502-131-112-63-87.ngrok-free.app/v1"
8
  model_name = "cyberagent/calm3-22b-chat"
9
  """
10
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
@@ -36,17 +35,6 @@ def respond(
36
 
37
  response = ""
38
 
39
- """
40
- #streaming無し: gradio側が対応してない
41
- completion = client.chat.completions.create(model=model_name,
42
- messages=messages,
43
- temperature=temperature,
44
- max_tokens=max_tokens,
45
- top_p=top_p,
46
- )
47
- text = completion.choices[0].message.content.strip()
48
- return text
49
- """
50
  for message in client.chat.completions.create(
51
  model=model_name,
52
  messages=messages,
 
1
  import gradio as gr
2
  # from huggingface_hub import InferenceClient
3
  from openai import OpenAI
4
+ import os
5
+ openai_api_key = os.getenv('api_key')
6
+ openai_api_base = os.getenv('url')
 
7
  model_name = "cyberagent/calm3-22b-chat"
8
  """
9
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
 
35
 
36
  response = ""
37
 
 
 
 
 
 
 
 
 
 
 
 
38
  for message in client.chat.completions.create(
39
  model=model_name,
40
  messages=messages,