Spaces:
Sleeping
Sleeping
add if-esle statement
Browse files
app.py
CHANGED
|
@@ -7,10 +7,19 @@ def greet(name):
|
|
| 7 |
|
| 8 |
|
| 9 |
async def summarize(input_text: str, input_url: str):
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
config = FilmConfig(
|
| 16 |
"gpt-3.5-turbo",
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
async def summarize(input_text: str, input_url: str):
|
| 10 |
+
if input_text:
|
| 11 |
+
_prompt = f"""
|
| 12 |
+
以下の文章を要約してください。
|
| 13 |
+
{input_text}
|
| 14 |
+
"""
|
| 15 |
+
elif input_url:
|
| 16 |
+
url_content = "URLのコンテンツを取得したものを代入します"
|
| 17 |
+
_prompt = f"""
|
| 18 |
+
以下の文章を要約してください。
|
| 19 |
+
{url_content}
|
| 20 |
+
"""
|
| 21 |
+
else:
|
| 22 |
+
_prompt = "文章が入力されていないことを主張してください。"
|
| 23 |
|
| 24 |
config = FilmConfig(
|
| 25 |
"gpt-3.5-turbo",
|