Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
import os
|
| 3 |
+
import streamlit as s
|
| 4 |
+
os.environ["OPENAI_API_KEY"]="sk-proj-uHasdgbriPPlFMm99ZtJT3BlbkFJOl231YfdxCSNmQjVEpMX"
|
| 5 |
+
|
| 6 |
+
responds=openai.chat.completions.create(
|
| 7 |
+
model="gpt-3.5-turbo",
|
| 8 |
+
messages=[
|
| 9 |
+
{"role": "system", "content": "you are a very good assistant"},# set the behaviour of
|
| 10 |
+
{"role": "user", "content": "hi how are you"}
|
| 11 |
+
],
|
| 12 |
+
temperature=0,
|
| 13 |
+
max_tokens=200
|
| 14 |
+
|
| 15 |
+
)
|
| 16 |
+
s.write(responds.choices[0].message.content)
|