Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import g4f
|
2 |
+
import gradio as gr
|
3 |
+
import nest_asyncio
|
4 |
+
nest_asyncio.apply()
|
5 |
+
|
6 |
+
import g4f
|
7 |
+
|
8 |
+
g4f.debug.logging = True # Enable logging
|
9 |
+
g4f.check_version = False # Disable automatic version checking
|
10 |
+
print(g4f.version) # Check version
|
11 |
+
print(g4f.Provider.Ails.params) # Supported args
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
def rr(i):
|
17 |
+
# Normal response
|
18 |
+
response = g4f.ChatCompletion.create(
|
19 |
+
model=g4f.models.gpt_35_turbo,
|
20 |
+
messages=[{"role": "user", "content": "Hello"}],
|
21 |
+
) # Alternative model setting
|
22 |
+
|
23 |
+
return response
|
24 |
+
|
25 |
+
iface = gr.Interface(
|
26 |
+
fn=rr,
|
27 |
+
inputs=gr.Textbox(label="Question:", lines=4),
|
28 |
+
outputs=gr.Textbox(label="Réponse"),
|
29 |
+
title="bot",
|
30 |
+
description="By Isa Ibn Maryam. 😂😂 Vas dormir ! Espace fermé ! ")
|
31 |
+
|
32 |
+
iface.launch()
|