Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import openai
|
| 3 |
-
import os
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
def generate_article(title):
|
| 9 |
-
prompt = f"์ฃผ์ : {title}\n\n์ด ์ฃผ์ ์ ๋ํด 3~5๋ฌธ๋จ ์ ๋์ ์ฝํ
์ธ ์ด์์ ์์ฑํด์ค:"
|
| 10 |
-
|
| 11 |
-
try:
|
| 12 |
-
response = openai.ChatCompletion.create(
|
| 13 |
-
model="gpt-3.5-turbo",
|
| 14 |
-
messages=[
|
| 15 |
-
{"role": "user", "content": prompt}
|
| 16 |
-
],
|
| 17 |
-
max_tokens=500
|
| 18 |
-
)
|
| 19 |
-
return response['choices'][0]['message']['content']
|
| 20 |
-
except Exception as e:
|
| 21 |
-
return f"[์๋ฌ] {str(e)}"
|
| 22 |
|
| 23 |
demo = gr.Interface(
|
| 24 |
-
fn=
|
| 25 |
-
inputs=
|
| 26 |
-
outputs=
|
| 27 |
-
title="GPT ์ฝํ
์ธ ์ด์ ์์ฑ๊ธฐ"
|
| 28 |
)
|
| 29 |
|
| 30 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
def greet(name):
|
| 4 |
+
return "Hello " + name + "!!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
demo = gr.Interface(
|
| 7 |
+
fn=greet,
|
| 8 |
+
inputs="text",
|
| 9 |
+
outputs="text"
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
demo.launch()
|