Spaces:
Sleeping
Sleeping
DiningSystem
commited on
Commit
•
f749ddc
1
Parent(s):
a1978ee
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,10 @@ import openai
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
openai.api_key = os.environ['openai']
|
5 |
-
def write_essay(prompt,
|
6 |
model="gpt-3.5-turbo"
|
7 |
temp_list = prompt.split()
|
8 |
-
temp_list2 =
|
9 |
temperature = temperature/10
|
10 |
frequency_penalty = frequency_penalty/10 - 2
|
11 |
presence_penalty = presence_penalty/10 -2
|
@@ -31,7 +31,7 @@ def write_essay(prompt, context, temperature, frequency_penalty, presence_penalt
|
|
31 |
message = response.choices[0]["message"]["content"]
|
32 |
#print(message)
|
33 |
return message
|
34 |
-
demo = gr.Interface(fn=write_essay, inputs=["
|
35 |
gr.Slider(0, 20, value=4, step=1, label="Creative vs Focus", info="Increase for creative and decrease for more focused"),
|
36 |
gr.Slider(0, 40, value=20, step=1, label="Frequency of words", info="Increase to decrease repeated words"),
|
37 |
gr.Slider(0, 40, value=20, step=1, label="Presence of words", info="Increase to decrease already appeared words")
|
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
openai.api_key = os.environ['openai']
|
5 |
+
def write_essay(prompt, character, temperature, frequency_penalty, presence_penalty):
|
6 |
model="gpt-3.5-turbo"
|
7 |
temp_list = prompt.split()
|
8 |
+
temp_list2 = character.split()
|
9 |
temperature = temperature/10
|
10 |
frequency_penalty = frequency_penalty/10 - 2
|
11 |
presence_penalty = presence_penalty/10 -2
|
|
|
31 |
message = response.choices[0]["message"]["content"]
|
32 |
#print(message)
|
33 |
return message
|
34 |
+
demo = gr.Interface(fn=write_essay, inputs=[gr.Textbox(label="Prompt",info="Your Request",lines=5, value=""),gr.Textbox(label="Characteristic of the AI",info="Put Character for AI",lines=1, value=""),
|
35 |
gr.Slider(0, 20, value=4, step=1, label="Creative vs Focus", info="Increase for creative and decrease for more focused"),
|
36 |
gr.Slider(0, 40, value=20, step=1, label="Frequency of words", info="Increase to decrease repeated words"),
|
37 |
gr.Slider(0, 40, value=20, step=1, label="Presence of words", info="Increase to decrease already appeared words")
|