diegocp01 commited on
Commit
4676f73
·
verified ·
1 Parent(s): b920863

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import os
3
+
4
+ # Initialize the OpenAI client
5
+ from openai import OpenAI
6
+ # HF
7
+ API_KEY = os.getenv("OPENAI_API_KEY")
8
+ client = OpenAI(api_key=API_KEY)
9
+
10
+ import gradio as gr
11
+
12
+ def gpt41(users_input):
13
+ response = client.responses.create(
14
+ model="gpt-4.1",
15
+ input=users_input
16
+ )
17
+ return(response.output_text)
18
+
19
+ demo = gr.Interface(fn=gpt41, inputs="text", outputs="text")
20
+ demo.launch()