Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,21 @@ from openai import OpenAI
|
|
| 4 |
|
| 5 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 6 |
|
| 7 |
-
def check_compliance(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
response = client.responses.create(
|
| 9 |
model="gpt-4.1-nano",
|
| 10 |
-
input=
|
| 11 |
temperature=0.1
|
| 12 |
)
|
|
|
|
| 13 |
return response.output[0].content[0].text
|
| 14 |
|
| 15 |
gr.Interface(
|
| 16 |
fn=check_compliance,
|
| 17 |
-
inputs=gr.
|
| 18 |
outputs=gr.Textbox(lines=15, label="Compliance Result"),
|
| 19 |
).launch()
|
|
|
|
| 4 |
|
| 5 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 6 |
|
| 7 |
+
def check_compliance(file):
|
| 8 |
+
# file is a TemporaryUploadedFile object
|
| 9 |
+
with open(file.name, "r", encoding="utf-8") as f:
|
| 10 |
+
content = f.read()
|
| 11 |
+
|
| 12 |
response = client.responses.create(
|
| 13 |
model="gpt-4.1-nano",
|
| 14 |
+
input=content,
|
| 15 |
temperature=0.1
|
| 16 |
)
|
| 17 |
+
|
| 18 |
return response.output[0].content[0].text
|
| 19 |
|
| 20 |
gr.Interface(
|
| 21 |
fn=check_compliance,
|
| 22 |
+
inputs=gr.File(label="Upload Proposal",file_types=[".docx"])
|
| 23 |
outputs=gr.Textbox(lines=15, label="Compliance Result"),
|
| 24 |
).launch()
|