Update app.py
Browse files
app.py
CHANGED
|
@@ -2,19 +2,9 @@ import g4f
|
|
| 2 |
import gradio as gr
|
| 3 |
import nest_asyncio
|
| 4 |
nest_asyncio.apply()
|
| 5 |
-
import psycopg2
|
| 6 |
|
| 7 |
-
# Connexion à la base de données PostgreSQL
|
| 8 |
-
conn = psycopg2.connect(
|
| 9 |
-
dbname="verceldb",
|
| 10 |
-
user="default",
|
| 11 |
-
password="u0Er5IOhTwdU",
|
| 12 |
-
host="ep-steep-wildflower-71166293.us-east-1.postgres.vercel-storage.com",
|
| 13 |
-
port="5432"
|
| 14 |
-
)
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
cursor = conn.cursor()
|
| 18 |
|
| 19 |
|
| 20 |
import g4f
|
|
@@ -33,9 +23,7 @@ def rr(i):
|
|
| 33 |
model=g4f.models.gpt_35_turbo,
|
| 34 |
messages=[{"role": "user", "content": i}],
|
| 35 |
) # Alternative model setting
|
| 36 |
-
|
| 37 |
-
cursor.execute(insert_query, (i, response))
|
| 38 |
-
conn.commit()
|
| 39 |
|
| 40 |
|
| 41 |
return response
|
|
@@ -46,6 +34,4 @@ iface = gr.Interface(
|
|
| 46 |
outputs=gr.Textbox(label="Réponse"),
|
| 47 |
title="bot",
|
| 48 |
description="By Isa Ibn Maryam. 😂😂 Vas dormir ! Espace fermé ! ")
|
| 49 |
-
cursor.close()
|
| 50 |
-
conn.close()
|
| 51 |
iface.launch()
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import nest_asyncio
|
| 4 |
nest_asyncio.apply()
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# Connexion à la
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
import g4f
|
|
|
|
| 23 |
model=g4f.models.gpt_35_turbo,
|
| 24 |
messages=[{"role": "user", "content": i}],
|
| 25 |
) # Alternative model setting
|
| 26 |
+
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
return response
|
|
|
|
| 34 |
outputs=gr.Textbox(label="Réponse"),
|
| 35 |
title="bot",
|
| 36 |
description="By Isa Ibn Maryam. 😂😂 Vas dormir ! Espace fermé ! ")
|
|
|
|
|
|
|
| 37 |
iface.launch()
|