seawolf2357 commited on
Commit
9754c11
ยท
verified ยท
1 Parent(s): 71d06ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -29,17 +29,14 @@ def predict(inputs, top_p, temperature, openai_api_key):
29
  else:
30
  return "Error: Unable to generate response."
31
 
32
- title = "<h1 align='center'>ํ˜œ์ž ์Šคํฌ๋ฆฝํŠธ</h1>"
33
- description = "์˜์ƒ ์ƒ์„ฑ์„ ์œ„ํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ AI๊ฐ€ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ฃผ์ œ ํ‚ค์›Œ๋“œ๋‚˜ ๋ชฉ์  ๋“ฑ ํ•„์š”ํ•œ ๋‚ด์šฉ๋งŒ ๊ฐ„๋‹จํžˆ ์ž…๋ ฅํ•˜์„ธ์š”."
34
-
35
  with gr.Blocks() as demo:
36
- gr.HTML(title)
37
- openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
38
- inputs = gr.Textbox(placeholder="์—ฌ๊ธฐ์— ์ž…๋ ฅํ•˜์„ธ์š”.", label="๋‚˜๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹ถ์€ ์ฃผ์ œ์–ด๋‚˜ ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜์„ธ์š”.")
39
- output = gr.Textbox(label="Generated Script", readonly=True)
40
  with gr.Row():
 
 
41
  top_p = gr.Slider(minimum=0, maximum=1.0, value=1.0, step=0.05, label="Top-p (nucleus sampling)")
42
  temperature = gr.Slider(minimum=0, maximum=5.0, value=1.0, step=0.1, label="Temperature")
 
43
  submit_button = gr.Button("Generate")
44
  submit_button.click(fn=predict, inputs=[inputs, top_p, temperature, openai_api_key], outputs=output)
45
 
@@ -50,6 +47,6 @@ with gr.Blocks() as demo:
50
  ["์ •๋ณด ๊ณต์œ : ๋น„ํƒ€๋ฏผC ๊ณผ๋‹ค ๋ณต์šฉ์€ ๊ฑด๊ฐ•์— ์˜คํžˆ๋ ค ํ•ด๋กญ๋‹ค."],
51
  ["ํ™๋ณด: 'OpenAI'๋Š” '์ฑ—GPT'์˜ ๋งž์ถค GPT '์Šคํ† ์–ด'๋ฅผ ์˜คํ”ˆํ•˜์˜€๋‹ค."],
52
  ["์ธ์‚ฌ: '์• ํ”Œ ๋ฒ•์ธ'์˜ ๊ณ ๊ฐ๊ณผ ์ž„์ง์›์„ ์œ„ํ•œ ์ง„์ทจ์ ์ธ 2024๋…„ ์‹ ๋…„ ์ธ์‚ฌ"]
53
- ], inputs=[inputs], fn=predict, outputs=output)
54
 
55
  demo.launch()
 
29
  else:
30
  return "Error: Unable to generate response."
31
 
 
 
 
32
  with gr.Blocks() as demo:
33
+ gr.Markdown("<h1 align='center'>ํ˜œ์ž ์Šคํฌ๋ฆฝํŠธ</h1>")
 
 
 
34
  with gr.Row():
35
+ openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
36
+ inputs = gr.Textbox(placeholder="์—ฌ๊ธฐ์— ์ž…๋ ฅํ•˜์„ธ์š”.", label="๋‚˜๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹ถ์€ ์ฃผ์ œ์–ด๋‚˜ ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜์„ธ์š”.")
37
  top_p = gr.Slider(minimum=0, maximum=1.0, value=1.0, step=0.05, label="Top-p (nucleus sampling)")
38
  temperature = gr.Slider(minimum=0, maximum=5.0, value=1.0, step=0.1, label="Temperature")
39
+ output = gr.Textbox(label="Generated Script", readonly=True)
40
  submit_button = gr.Button("Generate")
41
  submit_button.click(fn=predict, inputs=[inputs, top_p, temperature, openai_api_key], outputs=output)
42
 
 
47
  ["์ •๋ณด ๊ณต์œ : ๋น„ํƒ€๋ฏผC ๊ณผ๋‹ค ๋ณต์šฉ์€ ๊ฑด๊ฐ•์— ์˜คํžˆ๋ ค ํ•ด๋กญ๋‹ค."],
48
  ["ํ™๋ณด: 'OpenAI'๋Š” '์ฑ—GPT'์˜ ๋งž์ถค GPT '์Šคํ† ์–ด'๋ฅผ ์˜คํ”ˆํ•˜์˜€๋‹ค."],
49
  ["์ธ์‚ฌ: '์• ํ”Œ ๋ฒ•์ธ'์˜ ๊ณ ๊ฐ๊ณผ ์ž„์ง์›์„ ์œ„ํ•œ ์ง„์ทจ์ ์ธ 2024๋…„ ์‹ ๋…„ ์ธ์‚ฌ"]
50
+ ], inputs=[inputs], fn=predict, outputs=output)
51
 
52
  demo.launch()