seawolf2357 commited on
Commit
0745d65
Β·
verified Β·
1 Parent(s): c82d9a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -12,7 +12,7 @@ OPENAI_API_KEY = os.getenv("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"
12
  def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[], history=[]):
13
 
14
  # μ‚¬μš©μžμ˜ μž…λ ₯을 λ‚˜λ ˆμ΄μ…˜ μŠ€νƒ€μΌμ˜ ν”„λ‘¬ν”„νŠΈλ‘œ λ³€ν™˜
15
- narration_prompt = f"λ™μ˜μƒμ— μ‚¬μš©ν•  전문적인 λ‚˜λ ˆμ΄μ…˜μ„ μž‘μ„±ν•˜λΌ.일체의 μ§€λ¬Έμ΄λ‚˜ μ§€μ‹œ, λ°°κ²½ μ„€λͺ… 등을 λ…ΈμΆœ ν•˜κ±°λ‚˜ 좜λ ₯ν•˜μ§€ 말고 μˆœμˆ˜ν•œ λ‚˜λ ˆμ΄μ…˜λ§Œ 2쀄씩 λ¬Άμ–΄μ„œ μ΅œλŒ€ 8쀄 μ΄λ‚΄λ‘œ 좜λ ₯λ ₯. μž…λ ₯: '{inputs}'"
16
 
17
  payload = {
18
  "model": "gpt-4-1106-preview",
@@ -103,8 +103,8 @@ def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[]
103
  def reset_textbox():
104
  return gr.update(value='')
105
 
106
- title = """<h1 align="center">κΈ€ 생성</h1>"""
107
- description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
108
  ```
109
  User: <utterance>
110
  Assistant: <utterance>
@@ -114,15 +114,18 @@ Assistant: <utterance>
114
  ```
115
  In this app, you can explore the outputs of a gpt-3.5-turbo LLM.
116
  """
117
-
 
118
  with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
119
  #chatbot {height: 520px; overflow: auto;}""") as demo:
120
  gr.HTML(title)
121
  with gr.Column(elem_id = "col_container"):
122
  openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
123
- chatbot = gr.Chatbot(elem_id='chatbot') #c
124
- inputs = gr.Textbox(placeholder= "Type here!", label= "Type an input and press Enter") #t
125
- state = gr.State([]) #s
 
 
126
  b1 = gr.Button()
127
 
128
  #inputs, top_p, temperature, top_k, repetition_penalty
 
12
  def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[], history=[]):
13
 
14
  # μ‚¬μš©μžμ˜ μž…λ ₯을 λ‚˜λ ˆμ΄μ…˜ μŠ€νƒ€μΌμ˜ ν”„λ‘¬ν”„νŠΈλ‘œ λ³€ν™˜
15
+ narration_prompt = f"λ™μ˜μƒμ— μ‚¬μš©ν•  전문적인 λ‚˜λ ˆμ΄μ…˜μ„ μž‘μ„±ν•˜λΌ. λ°˜λ“œμ‹œ ν•œκΈ€λ‘œ μž‘μ„±ν• κ²ƒ. 일체의 μ§€λ¬Έμ΄λ‚˜ μ§€μ‹œ, λ°°κ²½ μ„€λͺ… 등을 λ…ΈμΆœ ν•˜κ±°λ‚˜ 좜λ ₯ν•˜μ§€ 말고 μˆœμˆ˜ν•œ λ‚˜λ ˆμ΄μ…˜λ§Œ 2쀄씩 λ¬Άμ–΄μ„œ μ΅œλŒ€ 8쀄 μ΄λ‚΄λ‘œ 좜λ ₯λ ₯. μž…λ ₯: '{inputs}'"
16
 
17
  payload = {
18
  "model": "gpt-4-1106-preview",
 
103
  def reset_textbox():
104
  return gr.update(value='')
105
 
106
+ title = """<h1 align="center">혜자 슀크립트</h1>"""
107
+ description = """μ˜μƒ 생성을 μœ„ν•œ 슀크립트λ₯Ό AIκ°€ μžλ™μœΌλ‘œ μƒμ„±ν•©λ‹ˆλ‹€. 주제 ν‚€μ›Œλ“œλ‚˜ λͺ©μ  λ“± ν•„μš”ν•œ λ‚΄μš©λ§Œ κ°„λ‹¨νžˆ μž…λ ₯ν•˜μ„Έμš”. :
108
  ```
109
  User: <utterance>
110
  Assistant: <utterance>
 
114
  ```
115
  In this app, you can explore the outputs of a gpt-3.5-turbo LLM.
116
  """
117
+
118
+
119
  with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
120
  #chatbot {height: 520px; overflow: auto;}""") as demo:
121
  gr.HTML(title)
122
  with gr.Column(elem_id = "col_container"):
123
  openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
124
+
125
+ # 좜λ ₯폼 (chatbot)을 μ‚¬μš©μž μž…λ ₯폼 (inputs) μ•žμ— 배치
126
+ chatbot = gr.Chatbot(elem_id='chatbot') # c
127
+ inputs = gr.Textbox(placeholder="여기에 μž…λ ₯ν•˜μ„Έμš”.", label="λ‚˜λ ˆμ΄μ…˜ 슀크립트λ₯Ό μƒμ„±ν•˜κ³  싢은 μ£Όμ œμ–΄λ‚˜ λ¬Έμž₯을 μž…λ ₯ν•˜μ„Έμš”.") # t
128
+ state = gr.State([]) # s
129
  b1 = gr.Button()
130
 
131
  #inputs, top_p, temperature, top_k, repetition_penalty