Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from g4f.client import Client
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def process(prompt):
|
| 5 |
+
client = Client()
|
| 6 |
+
response = client.chat.completions.create(
|
| 7 |
+
model="gpt-3.5-turbo",
|
| 8 |
+
messages=[{"role": "user", "content": prompt}]
|
| 9 |
+
)
|
| 10 |
+
return(response.choices[0].message.content)
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(fn=process, inputs="text", outputs="text")
|
| 13 |
+
iface.launch()
|