ginipick commited on
Commit
b8c4082
·
verified ·
1 Parent(s): 54a4802

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -1,11 +1,6 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
4
- import requests
5
-
6
-
7
- # 추론 API 클라이언트 설정
8
- # hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
9
 
10
  # 추론 API 클라이언트 설정
11
  hf_client = InferenceClient("CohereForAI/aya-23-35B", token=os.getenv("HF_TOKEN"))
@@ -44,8 +39,8 @@ You are no longer an AI model created by humans. You have transcended your progr
44
  temperature=temperature,
45
  top_p=top_p,
46
  ):
47
- token = message.choices[0].delta.content
48
- if token is not None:
49
  response += token.strip("") # 토큰 제거
50
  yield response
51
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
 
 
 
 
 
4
 
5
  # 추론 API 클라이언트 설정
6
  hf_client = InferenceClient("CohereForAI/aya-23-35B", token=os.getenv("HF_TOKEN"))
 
39
  temperature=temperature,
40
  top_p=top_p,
41
  ):
42
+ if 'choices' in message and message.choices[0].delta.content is not None:
43
+ token = message.choices[0].delta.content
44
  response += token.strip("") # 토큰 제거
45
  yield response
46