Spaces:
Runtime error
Runtime error
Update content_only.py
Browse files- content_only.py +3 -16
content_only.py
CHANGED
@@ -1,34 +1,21 @@
|
|
1 |
-
# %pip install --upgrade openai
|
2 |
-
# !pip install chainlit
|
3 |
-
# !pip install langchain
|
4 |
-
|
5 |
-
import chainlit as cl
|
6 |
import openai
|
7 |
import gradio as gr
|
8 |
openai.api_key = "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"
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
response = openai.ChatCompletion.create(
|
14 |
-
|
15 |
model="gpt-3.5-turbo",
|
16 |
-
messages=[
|
17 |
-
|
18 |
-
|
19 |
{"role":"user","content": user_message}
|
20 |
],
|
21 |
-
|
22 |
temperature=1,
|
23 |
max_tokens=256,
|
24 |
top_p=1,
|
25 |
frequency_penalty=0,
|
26 |
presence_penalty=0
|
27 |
)
|
28 |
-
|
29 |
return response['choices'][0]['message']['content']
|
30 |
|
31 |
-
|
32 |
title ='Just show the main content'
|
33 |
description = "From json, get ONLY the content"
|
34 |
examples = [
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
openai.api_key = "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"
|
4 |
|
5 |
+
def get_gpt_output(user_message):
|
6 |
+
response = openai.ChatCompletion.create(
|
|
|
|
|
|
|
7 |
model="gpt-3.5-turbo",
|
8 |
+
messages=[
|
|
|
|
|
9 |
{"role":"user","content": user_message}
|
10 |
],
|
|
|
11 |
temperature=1,
|
12 |
max_tokens=256,
|
13 |
top_p=1,
|
14 |
frequency_penalty=0,
|
15 |
presence_penalty=0
|
16 |
)
|
|
|
17 |
return response['choices'][0]['message']['content']
|
18 |
|
|
|
19 |
title ='Just show the main content'
|
20 |
description = "From json, get ONLY the content"
|
21 |
examples = [
|