seawolf2357 commited on
Commit
83ebdaf
·
verified ·
1 Parent(s): ac9578e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -83,7 +83,7 @@ def format_prompt(message, history):
83
  prompt += f"[INST] {message} [/INST]"
84
  return prompt
85
 
86
- def generate(prompt, history, temperature=0.1, max_new_tokens=25000, top_p=0.95, repetition_penalty=1.0):
87
  input_tokens = len(tokenizer.encode(prompt))
88
  available_tokens = 32768 - input_tokens
89
  max_new_tokens = min(max_new_tokens, available_tokens)
@@ -104,20 +104,12 @@ def generate(prompt, history, temperature=0.1, max_new_tokens=25000, top_p=0.95,
104
  except Exception as e:
105
  yield f"Error: {str(e)}"
106
 
107
- mychatbot = gr.Chatbot(
108
- avatar_images=["./user.png", "./botm.png"],
109
- bubble_full_width=True,
110
- show_label=False,
111
- show_copy_button=True,
112
- likeable=True,
113
- )
114
-
115
  examples = [
116
- ["좋은 예제를 알려줘."],
117
- ["requirements.txt 출력"],
118
- ["전체 코드를 다시 출력"],
119
- ["코드 오류를 확인하고 자세히 설명해줘."],
120
- ["Huggingface와 Gradio를 사용하는 방법에 대해 물어보세요."]
121
  ]
122
 
123
  demo = gr.Interface(
@@ -126,7 +118,6 @@ demo = gr.Interface(
126
  outputs=gr.Markdown(),
127
  examples=examples,
128
  title="AIQ 코드파일럿: OpenLLM v1.12",
129
- description="AIQ Codepilot과 상호작용해 보세요."
130
  )
131
 
132
  demo.launch(show_api=False)
 
83
  prompt += f"[INST] {message} [/INST]"
84
  return prompt
85
 
86
+ def generate(prompt, history=[], temperature=0.1, max_new_tokens=25000, top_p=0.95, repetition_penalty=1.0):
87
  input_tokens = len(tokenizer.encode(prompt))
88
  available_tokens = 32768 - input_tokens
89
  max_new_tokens = min(max_new_tokens, available_tokens)
 
104
  except Exception as e:
105
  yield f"Error: {str(e)}"
106
 
 
 
 
 
 
 
 
 
107
  examples = [
108
+ ["좋은 예제를 알려줘.", []], # history 값을 빈 리스트로 제공
109
+ ["requirements.txt 출력", []],
110
+ ["전체 코드를 다시 출력", []],
111
+ ["코드 오류를 확인하고 자세히 설명해줘.", []],
112
+ ["Huggingface와 Gradio를 사용하는 방법에 대해 물어보세요.", []]
113
  ]
114
 
115
  demo = gr.Interface(
 
118
  outputs=gr.Markdown(),
119
  examples=examples,
120
  title="AIQ 코드파일럿: OpenLLM v1.12",
 
121
  )
122
 
123
  demo.launch(show_api=False)