Update app.py
Browse files
app.py
CHANGED
|
@@ -24,12 +24,10 @@ def generate_response(user_prompt):
|
|
| 24 |
'jsonl νμΌμ μμμ λ€μκ³Ό κ°μ: {"Description": "000", "Etymology": "000", "Etymology.Type": "000", "Name": "000", "Magic": "000", "KeySentence": "000", "Body color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]", "Hair style": "000", "Hair color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]","Hand-held item": "000", "Hand-held item color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]"}'
|
| 25 |
)},
|
| 26 |
{"role": "user", "content": user_prompt}
|
| 27 |
-
]
|
| 28 |
-
max_tokens=2048,
|
| 29 |
-
temperature=0.8
|
| 30 |
)
|
| 31 |
# ChatCompletion μλ΅ ν
μ€νΈ λ°ν
|
| 32 |
-
return response[
|
| 33 |
except openai.OpenAIError as e:
|
| 34 |
# OpenAI κ΄λ ¨ μλ¬ μ²λ¦¬
|
| 35 |
return f"OpenAI API μ€λ₯: {str(e)}"
|
|
@@ -50,6 +48,7 @@ interface = gr.Interface(
|
|
| 50 |
theme="compact" # Gradio μΈν°νμ΄μ€μ ν
λ§ μ€μ
|
| 51 |
)
|
| 52 |
|
|
|
|
| 53 |
# μ± μ€ν
|
| 54 |
if __name__ == "__main__":
|
| 55 |
interface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)))
|
|
|
|
| 24 |
'jsonl νμΌμ μμμ λ€μκ³Ό κ°μ: {"Description": "000", "Etymology": "000", "Etymology.Type": "000", "Name": "000", "Magic": "000", "KeySentence": "000", "Body color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]", "Hair style": "000", "Hair color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]","Hand-held item": "000", "Hand-held item color": "[Hue: 00.0, Saturation: 0.00, Value: 0.00]"}'
|
| 25 |
)},
|
| 26 |
{"role": "user", "content": user_prompt}
|
| 27 |
+
]
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
# ChatCompletion μλ΅ ν
μ€νΈ λ°ν
|
| 30 |
+
return response["choices"][0]["message"]["content"].strip()
|
| 31 |
except openai.OpenAIError as e:
|
| 32 |
# OpenAI κ΄λ ¨ μλ¬ μ²λ¦¬
|
| 33 |
return f"OpenAI API μ€λ₯: {str(e)}"
|
|
|
|
| 48 |
theme="compact" # Gradio μΈν°νμ΄μ€μ ν
λ§ μ€μ
|
| 49 |
)
|
| 50 |
|
| 51 |
+
|
| 52 |
# μ± μ€ν
|
| 53 |
if __name__ == "__main__":
|
| 54 |
interface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)))
|