Spaces:
Runtime error
Runtime error
Farhan1572
commited on
Commit
•
9f91f15
1
Parent(s):
2139abb
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,18 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from openai import OpenAI
|
3 |
import os
|
4 |
|
|
|
5 |
api_key = os.getenv("OPENAI_API_KEY")
|
6 |
|
|
|
7 |
client = OpenAI(api_key = api_key)
|
8 |
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
# finetuned_model = "ft:gpt-3.5-turbo-0125:cedarbyte-business-solutions::9PRHsQbf"
|
13 |
-
finetuned_model = "ft:gpt-3.5-turbo-0125:cedarbyte-business-solutions::9Pthp1Dc"
|
14 |
-
|
15 |
def humanize_text(AI_text):
|
16 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
17 |
response = completion = client.chat.completions.create(
|
@@ -31,6 +32,7 @@ def humanize_text(AI_text):
|
|
31 |
|
32 |
return response.choices[0].message.content.strip()
|
33 |
|
|
|
34 |
# Gradio interface definition
|
35 |
interface = gr.Interface(
|
36 |
fn=humanize_text,
|
|
|
1 |
+
# import dependencies
|
2 |
import gradio as gr
|
3 |
from openai import OpenAI
|
4 |
import os
|
5 |
|
6 |
+
# define the openai key
|
7 |
api_key = os.getenv("OPENAI_API_KEY")
|
8 |
|
9 |
+
# make an instance of the openai client
|
10 |
client = OpenAI(api_key = api_key)
|
11 |
|
12 |
+
# finetuned model instance
|
13 |
+
finetuned_model = "ft:gpt-3.5-turbo-0125:cedarbyte-business-solutions::9czCxtOx"
|
14 |
|
15 |
+
# function to humanize the text
|
|
|
|
|
|
|
|
|
16 |
def humanize_text(AI_text):
|
17 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
18 |
response = completion = client.chat.completions.create(
|
|
|
32 |
|
33 |
return response.choices[0].message.content.strip()
|
34 |
|
35 |
+
|
36 |
# Gradio interface definition
|
37 |
interface = gr.Interface(
|
38 |
fn=humanize_text,
|